I have a script that creates an IntValue with the name “heart” on the player as soon as it enters.
The problem is that it generates an error: “attempt to index number with ‘GetPropertyChangedSignal’”. Until I could use the “Changed” event, however I would like to use “GetPropertyChangedSignal” to be more practical.
Can anyone help?
script:
game.Players.PlayerAdded:Connect(function(plr)
local leader = Instance.new("Folder",plr)
leader.Name = "PlayerInfo"
local Healthvalue = Instance.new("IntValue",leader)
Healthvalue.Name = "Heart"
Healthvalue = 5
Healthvalue:GetPropertyChangedSignal("Value"):Connect(function()
print("ALTEREED")
if Healthvalue == 0 then
plr.Character:WaitForChild("Humanoid").Health = 0
end
end)
end)