Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For some reason it wont destroy itself or subtract from value??

Asked by 1 year ago

whenever it dies it doesnt destroy it self or subtract from value

local mobnumb = game.ServerScriptService.DeathCheck.mobnumber
local hum = script.Parent

hum.Died:Connect(function()

    mobnumb.Value -= 1
    hum.Parent:Destroy()

end)
0
Where is this script parented? Is it local or server? OhManXDXD 445 — 1y

1 answer

Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
1 year ago

Hello! I've examined your script, and I am here to help.

I've found an issue on line 6

mobnumb.Value -= 1

That line of code is wrong, the correct code would be:

mobnumb.Value = (mobnumb.Value-1)

I'm not sure why you're trying to delete the player's character model but that should work If the value error gets fixed.

Make sure the script is not a LocalScript or It won't work as you're trying to set a value that's located in ServerScriptService meaning It has to be server-sided.

Ad

Answer this question