So I’m trying to work on a system that spawns a hitbox on the client, then fires a remote to the server where damage is calculated. I’ve got a picture below of the main function I’m using to spawn the hitboxes.
Now I’ve honestly got no idea if I’m going about it the right way and some of the code isn’t even fully fleshed out yet because I just wanna get the remote aspect working first, but getting the targets humanoid on the server does work properly, and the code does fire to the server.
Only problem is when it fires to the server, server has no idea what targetHmd is, and so I have no idea how to calculate damage on the server when I can’t even get the humanoid to pass through to the server.
It should be just on the client right now. I have the hitbox created on the client to find targetHmd, then I have the remote tell the server what targetHmd is. Though the server doesn’t understand that.
If the humanoid only exists on the client, then it wont replicate to the server. Make sure the Humanoid exists on the server too.
Forgive me if I didn’t understand your post, I’m literally using my phone whilst on a boat in Paris, when I am on PC I can understamd and articulate stuff better.
I might also be misunderstanding, but the humanoid that’s found should already exist on the server since it’s in a workspace model (i am using the default roblox zombie guy for testing say hi)
targetHmd is created on the client, and is just used to hold information. This way I can make sure targetHmd is a humanoid that should be damaged (doing this to avoid damaging the player who creates the hitbox). If the client gets Drooling Zombie’s Humanoid, then Drooling Zombie’s Humanoid should equal targetHmd. Then the targetHmd variable should be sent to the server for damage testing.
Ended up fixing it by inserting targetHmd instead of targetHmnd.Name
load:GetMarkerReachedSignal("activeFrames"):Connect(function(paramString)
print("activeFrames")
hitbox.BrickColor = BrickColor.new(0,255,0)
hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Humanoid") ~= humanoid then
local targetHmd = hit.Parent:FindFirstChild("Humanoid")
if not table.find(hitTargets, targetHmd) then
table.insert(hitTargets, targetHmd) -- change here
print(hitTargets)
combatRemote:InvokeServer(targetHmd, hitTargets, hitbox, debounce)
end
end
end)
end)