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

tween animation only works the first time it's activated?

I've made a script where if you touch a brick, it enables a gui and makes a tween animation however the animation will only work the first time it is activated, how can I fix this? (I'm a beginner at scripting so any advice is very helpful)

local player = game.Players.LocalPlayer

workspace.telexd.Touched:connect(function(hit)
	
    player.PlayerGui.ScreenGui.Enabled = true

player.PlayerGui.ScreenGui.TextLabel:TweenPosition(UDim2.new(0.423,0,0.812,0), 'Out', 'Elastic',1.5)

    wait(5)

 player.PlayerGui.ScreenGui.Enabled = false

wait(.1)

 player.PlayerGui.ScreenGui.Enabled = true

wait(.1)

 player.PlayerGui.ScreenGui.Enabled = false

wait(.1)

    player.PlayerGui.ScreenGui.Enabled = false

end)



1 comment

0

LocalPlayer is nil on the server.

1 answer

✓ Accepted answer

You need to set the gui back to the original position towards the bottom. I'd suggest tweening it back. It can't tween to a position it's already in lol.

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