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

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

Asked by 7 years ago
Edited 7 years ago

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

Log in to vote
1
Answered by 7 years ago

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.

0
It works anywhere, Anytime with anything in Studio. Well guess again... MineJulRBX 52 — 7y
0
Omg! I just moved the animation in a local script and the transparency change in a server script. Now it works! MineJulRBX 52 — 7y
0
Yeah it probably worked before, but Roblox changed things... A friend and I were noticing this with a plugin he developed. JasonTheOwner 391 — 7y
Ad

Answer this question