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

Problem with my gui?

I'm trying to show this gui when a player finishes the obby. It's a gui that uses tween to show it everytime a players points changes.

local player = game.Players.LocalPlayer

player.leaderstats.Points.Value.Changed:connect(function()
	script.Parent.Parent:TweenPosition(UDim2.new(0.4, 0, 0.2, 0), "Out", "In", 1.5, true)
	wait(5)
	script.Parent.Parent:TweenPosition(UDim2.new(0.4, 0, 1, 0), "Out", "Back", 1.5, true)
end)

Error: Players.Player.PlayerGui.ObbyWin.Main.YouWon.Script:3: attempt to index field 'Value' (a number value)

1 answer

✓ Accepted answer

The script is recognizing .Value as a child of Points, all you have to do is remove it and the Gui should tween.

local player = game.Players.LocalPlayer

player.leaderstats.Points.Changed:connect(function()
    script.Parent.Parent:TweenPosition(UDim2.new(0.4, 0, 0.2, 0), "Out", "In", 1.5, true)
    wait(5)
    script.Parent.Parent:TweenPosition(UDim2.new(0.4, 0, 1, 0), "Out", "Back", 1.5, true)
end)

2 comments

0

Well, now it doesn't work in online mode.

0

Is the script in a local script?

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