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

Why does this TweenPosition script work when I run a Server, but not when I play?[FIXED]

Asked by 9 years ago

I wrote a TweenPosition script to open a Gui. It works perfectly fine when I start a Server on Studio, but when I disconnect from Studio and just play the game, it doesn't work at all. It's not giving me anything in the F9 console either. Help? It's in a regular Script, here's the code.

StatsBG = script.Parent.Parent.Parent.StatsBG
function open()
    if StatsBG.Visible == false then
        StatsBG.Visible = true
        StatsBG.Position = UDim2.new(0,545,0,-400)
        StatsBG:TweenPosition(UDim2.new(0,545,0,60), "In", "Quart", 1)
    else
        StatsBG.Visible = true
    end
end

script.Parent.MouseButton1Down:connect(open)

1 answer

Log in to vote
0
Answered by 9 years ago

Roblox broke that. You must make it a local script now.

0
I tried that, now it's giving me the error "StatsBG is not a valid member of ScreenGui" when I JOIN the game, not click the button. SlickPwner 534 — 9y
0
Send me a pic of the hierarchy. GetSporked 5 — 9y
0
Don't use local scripts, supposedly that's how most Roblox games are being hacked. omeybabyface 140 — 9y
0
Also do MouseButton1Click, MouseButton1Down is kind of bad because a player could click and hold and he doesn't have to release his mouse for it to work. MouseButton1Click makes it so when they release there mouse it works. GetSporked 5 — 9y
View all comments (2 more)
0
Fixed it myself. Thanks though. SlickPwner 534 — 9y
Ad

Answer this question