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

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

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

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

6 comments

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.

0

Send me a pic of the hierarchy.

0

Don't use local scripts, supposedly that's how most Roblox games are being hacked.

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.

0

Fixed it myself. Thanks though.

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