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

Why isn't .Changed firing this function?

I just need the text to change when the player levels up. It just isn't working though. Can anyone see any problems?

local plr = game.Players.LocalPlayer
plr.leaderstats.Level.Value.Changed:connect(function()
	script.Parent.Text = "Level".. plr.leaderstats.Level.Value
end)

1 comment

0

Make sure it's actually changing. Also, use :Connect (capital) since :connect is deprecated.

1 answer

First of all, .Changed isn't a member of a property, .Changed fires when an object's property changes. Second of all, :connect is deprecated, use :Connect instead. This is the code you should use

local plr = game.Players.LocalPlayer
plr.leaderstats.Level.Changed:Connect(function()
    script.Parent.Text = "Level".. plr.leaderstats.Level.Value
end)

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