#hitbox spawning where player last was before death
1 messages · Page 1 of 1 (latest)
function serverUtilities:hitbox(plr,move,additionalParam)
--warn("move:",move)
local character = plr.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local hrp = character:FindFirstChild("HumanoidRootPart")
local tempData = playerTemporalIndex:FindFirstChild(plr.Name .. "tempdata")
local buildFolder = tempData:FindFirstChild("build")
local playerClass = buildFolder:FindFirstChild("class").Value
local moveIndex = classes[playerClass]["moves"][move]
local hitbox = Instance.new("Part")
hitbox.Parent = game.Workspace
if additionalParam ~= nil and additionalParam >= 1 then
moveIndex = classes[playerClass]["moves"][move][additionalParam]
end
hitbox.Size = moveIndex["hitbox"]
hitbox.Anchored = true
hitbox.Transparency = .7
hitbox.CanCollide = false
local playerSettings = game.ReplicatedStorage.playerTemporal:FindFirstChild(plr.Name .. "tempdata"):FindFirstChild("settings")
local hasClientPriority = playerSettings:FindFirstChild("clientHitboxPriority")
if hasClientPriority then
local clientHrp = runtimeComms:InvokeClient(plr,"gethrp")
hitbox.CFrame = clientHrp * moveIndex["hrpdistance"]
else
--or if ping too high
hitbox.CFrame = hrp.CFame * moveIndex["hrpdistance"]
end
local ar = region3mod.FromPart(hitbox)
local result = region3mod.Cast(ar,character)
local playersHit = {}
for _,item in pairs (result) do
if table.find(gameInfo.bodyparts,item.Name) and item.Parent:FindFirstChildOfClass("Humanoid") and not table.find(playersHit,item.Parent) then
--print("detected")
local enemyHumanoid = item.Parent:FindFirstChildOfClass("Humanoid")
table.insert(playersHit,item.Parent)
--make sure to check if player has iframes or something
serverUtilities:damage(plr,enemyHumanoid,move,additionalParam)
end
end
game.Debris:AddItem(hitbox,.03)
return hitbox,result
end
i doubt its the hasClientPriority thingy because
- it's defaulted to false (and also is false in the video)
- it would literally ask the client where the humanoidrootpart is.
it could be the ragdoll but i'm not sure
update: it is not the ragdoll.
Try ts
** You are now Level 4! **
thx for responding, unfortunately it still spawns where the player last was when they died
still no luck 😭
Check output
no errors in output 💔
the one u sent? it's in a module script called serverUtilities, which is called by a server script called actionHandler
animationTrack:GetMarkerReachedSignal("hit"):Connect(function(param)
local number = tonumber(param)
if param == 0 then param = nil end
serverUtilities:hitbox(plr,move,number)
end)
** You are now Level 2! **
Ok ok
right now i'm running out of ideas so i'm lowkey just doing stupid stuff like this, trying to get it to work
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local function spawnHitbox(plr)
local char = plr.Character
if not char then return end
local hrp = char:FindFirstChild("HumanoidRootPart")
if not hrp then
warn("No HRP)
return
end
local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(5, 5, 5)
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = 0.5
hitbox.BrickColor = BrickColor.Red()
hitbox.CFrame = hrp.CFrame * CFrame.new(0, 0, -5)
hitbox.Parent = workspace
game.Debris:AddItem(hitbox, 0.5)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(1)
while character and character.Parent == workspace do
spawnHitbox(player)
wait(1)
end
end)
end)
Put this inside a new script inside of server script service
alright
weirdly enough that does work as intended, i reset and it's still spawning in front of me
Nice
oh my god.
i think i found it.
hold on if this works i'm gonna get mad
it worked.
Didn't it work before
no like i just fixed the entire thing
turns out
it's this specific line
it was checking if it existed at all
not it's actual value
@sonic oar thank you so much for your help though 😭 🙏, i'm sorry that it was something so goofy like this
Omg