I have a lot of scripts with UDim2 animations for my Gui.
First fix is that it got changed to Local Script
Second fix is that I used WaitForChild()
But this single script does still not work. (Not at all) It works completely fine in studio. It gives me no errors.
local num = 50 local backbutton = script.Parent.Parent.Back local Image = script.Parent.Parent:WaitForChild("Island") local Loco = script.Parent.Parent:WaitForChild("Loco") function onClicked() script.Parent:TweenPosition(UDim2.new(0.9, 0, -0.9, 0), "Out", "Quad", 1) script.Parent.Parent.TextButton:TweenPosition(UDim2.new(-0.9, 0, 0.9, 0), "Out", "Quad", 1) script.Parent.Parent.Change:TweenPosition(UDim2.new(0.5, 0, 0.3, 0), "Out", "Quad", 1) Image:TweenPosition(UDim2.new(0.9, 0, 0.4, 0), "Out", "Quad", 1) Loco:TweenPosition(UDim2.new(0.42, 0, -0.9, 0), "Out", "Quad", 1) for i = 1, num do backbutton.BackgroundTransparency = 1 - i/num/2 backbutton.TextTransparency = 1 - i/num/2 wait() end if backbutton.BackgroundTransparency == 0.5 then for i = 1, num do backbutton.BackgroundTransparency = backbutton.BackgroundTransparency - 0.01 backbutton.TextTransparency = backbutton.TextTransparency - 0.01 wait() end end script.Parent.Parent.Back.Active = true wait(0.6) end script.Parent.MouseButton1Down:connect(onClicked)
Put your MouseButton events in a localscript. Leave the other code in a server script, but call it from the localscript via a remote server event. That should fix the issues.
You said it works in studio - clicking Play button or doing a 1 player server? See if 1 player server works - I'm guessing it doesnt.