Need help about Changed event

Hi Dev,
I’m working on a obby and when the player pass a checkpoint the value TrueLevel increase of 1.
It’s all storage in the player and i need to get a fonction to fire when the value change

I tried that:

local player = script.Parent.Parent
local TrueLevels = player.OtherValue.TrueLevel

TrueLevels.Changed:Connect(function ()
	print("Changed")
end)

I have no error but no printing too

what is changing it?
It might not be changing

Yes it change when i pass checkpoint.
It works

But this script doesn’t

is one localscript and the other script?

also is there anything before it?(the code)

No all the scripts are scripts but each players have their own values and folders

try printing the parent? the parent might be not right

The script who add 1 each cheackpoint are in another script

like is that the full script or is there anything before that piece of code?

There’s nothing before this part

I Assume Its a Value

local player = script.Parent.Parent
local TrueLevels = player.OtherValue.TrueLevel

TrueLevels:GetPropertyChangedSignal("Value"):Connect(function ()
	print("Changed")
end)

@Fifouu_TV
Also Question: Is this a local script or a Server Script?

try adding print(script.Parent.Parent)

he said its a server script all of them

So Something like this:

game.Players.PlayerAdded:Connect(function(Plr)
local TrueLevels = Plr:WaitForChild("TrueLevel")

TrueLevels:GetPropertyChangedSignal("Value"):Connect(function()
print("Changed")
end)
end)

Thank You @MineGameIdle For Fixing it:

game.Players.PlayerAdded:Connect(function(Plr)
local TrueLevels = Plr:WaitForChild("OtherValue").TrueLevel

TrueLevels:GetPropertyChangedSignal("Value"):Connect(function()
print("Changed")
end)
end)

no it would be :

game.Players.PlayerAdded:Connect(function(Plr)
local TrueLevels = Plr:WaitForChild("OtherValue"):WaitForChild("TrueLevel")

TrueLevels:GetPropertyChangedSignal("Value"):Connect(function()
print("Changed")
end)
end)
1 Like

should i use local script ? (My goal is to use this value for another value for leaderstats)

This script is in starter player script

I will try you solution

This is a Server Script thing, put it inside ServerScriptService

1 Like

try putting a script in serverscriptservice and with that code

1 Like

Thx You two it worked !

See you soon on the DevForum !

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.