This is part of my gun drop script, which is supposed to make a gun spawn at the location that you died. However, it does not work as it returns the error
Players.Player.Backpack.MurderGun.ClientGunScript:66: attempt to call field 'Died' (a userdata value)
Here is my code
tool.Unequipped:connect(function(mouse)
if mouse then
mouse.Icon = defaulticon
end
end)
game.Players.LocalPlayer.Character.Humanoid.Died():connect(function()
print("Sheriff died")
local floatinggun = game.ReplicatedStorage.gameplay.Misc.floatinggun
local newgun = floatinggun:Clone()
newgun.Position = game.Players.LocalPlayer.Character.Head.CFrame.p
end)
Side note: The code is in a localscript

2 comments
This is not a syntax error. The code is perfectly syntactically valid -- it's just not the correct way to use the Died feature.
Oh, interesting