I'm trying to hurt the player but I can't do this locally because of Filtering Enabled.
Error message: Unable to cast Instance to float | Script 'Workspace.GlobalInstances', Line 2 --receiving script
Sending script/Local:
local clickdeb = true
mouse.Button1Down:connect(function()
if clickdeb then
clickdeb = false
if CheckAmmo() then
currentamount = currentamount - 1
spawn(function() bulletflash() updateammo() wait(.2) shootgui() end)
local bullet = shootbullet(shooter.CFrame.p, mouse.Hit.p)
local hit = ray(shooter.CFrame * CFrame.new(0,0,1), mouse.Hit.p)
local damage = math.random(dmgmin,dmgmax)
if hit then
if hit.Name == "Head" then damage = damage * 3 end
game.Workspace.GlobalInstances.HurtPlayer:FireServer(hit.Parent,damage)
print("youshotsomething")
end
end
wait(betweenshot)
clickdeb = true
end
end)
Normal script/Reciver:
script.HurtPlayer.OnServerEvent:connect(function(playertohurt,amount)
game.Workspace[playertohurt.Name].Humanoid:TakeDamage(amount)
end)
View script in source to see the full thing
