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

Had many UDim2 animations script fixed. But this one does still only work in Studio?

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)

1 answer

✓ Accepted answer

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.

3 comments

0

It works anywhere, Anytime with anything in Studio. Well guess again...

0

Omg! I just moved the animation in a local script and the transparency change in a server script. Now it works!

0

Yeah it probably worked before, but Roblox changed things... A friend and I were noticing this with a plugin he developed.

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