Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Killing the zombie doesn't change the value?

When the zombie dies it doesn't change the value

local zombiesleft = workspace.RoundSYSTEM.ZombiesLeft.Value
while true do
	wait(0.001)
	script.Parent:WaitForChild("Humanoid").Died:Connect(function()
		print('Zombie Died')
		zombiesleft -= 1
		script:Destroy()
	end)
end

2 comments

0

does it print "Zombie Died"

0

yes it does

1 answer

The error is on line 1 : I think you want to have access to change the value property of "ZombiesLeft". What you're actually doing is that you're setting the value to the number of zombies left. By doing this you will get the number of ZombiesLeft. However, you will not be able to change it. The correct way of doing this is :

local zombiesleft = workspace.RoundSYSTEM.ZombiesLeft
while true do
    wait(0.001)
    script.Parent:WaitForChild("Humanoid").Died:Connect(function()
        print('Zombie Died')
        zombiesleft.Value -= 1 --not sure of the syntax over here you can also use 	 
        --zombiesleft.Value = zombiesleft.Value - 1
        script:Destroy()
    end)
end

Now it might work ! Hope this helped :)

This discussion is preserved as it was. New answers, comments, and votes are closed.