I’m making a local script that creates a hitbox and a server script that detects when that hitbox hits a humanoid, then damages them. For some reason, the server side script is completely unresponsive. I’m not sure why as there aren’t any errors. I figure the reason why it doesn’t work is because I’m not actually detecting for a hit on a humanoid other than the character’s humanoid, but again, I’m not sure how to fix that.
Here’s a snippet from the local script which connects to the server script -
UIS.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == keybind then
anim:Play()
newHitbox1:SetPoints(rightarm, {Vector3.new(0.5, 1, -0.5), Vector3.new(-0.5, 1, 0.5), Vector3.new(0.5, 0, 0.5), Vector3.new(-0.5, 0, -0.5)})
event:FireServer()
newHitbox1:HitStart(1)
end
end)
This is the server script:
local player = game:GetService("Players")
local replicatedstorage = game:GetService("ReplicatedStorage")
local RaycastHitbox = require(replicatedstorage.RaycastHitboxV4)
game.ReplicatedStorage.instadeath.OnServerEvent:Connect(function(player, hit)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local leftarm = player.Character:WaitForChild("Left Arm")
local newHitbox1 = RaycastHitbox.new(leftarm)
newHitbox1.OnHit:Connect(function(hit, humanoid)
newHitbox1:RemovePoints(leftarm, {Vector3.new(0.5, 1, -0.5), Vector3.new(-0.5, 1, 0.5), Vector3.new(0.5, 0, 0.5), Vector3.new(-0.5, 0, -0.5)})
print("hit1")
humanoid:TakeDamage(25)
end)
end)
Please let me know if you know how to fix this!