Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with my gui?

Asked by
Relatch 550 Moderation Voter
9 years ago

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

Log in to vote
2
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

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)
0
Well, now it doesn't work in online mode. Relatch 550 — 9y
0
Is the script in a local script? M39a9am3R 3210 — 9y
Ad

Answer this question