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

Local script in text button only working in roblox studio, not working in the real game?

So I have Folder holding a from called 'Container' (which hold all kinda of text buttons. And I have textbutton with this script in it (it is a local script). The frame only becomes visible in studio.

local player = game.Players.LocalPlayer
local Container = script.Parent.Parent.Container

script.Parent.MouseButton1Click:connect(function()
	if Container.Visible == false then
		Container.Visible = true
	elseif Container.Visible == true then
		Container.Visible = false
	end
end)

1 answer

✓ Accepted answer

Hey! I have fixed up your script a bit, and the reason it works in studio and not the actual game, might be because it hasnt found the "Container". Here is the fixed up version I made:

local player = game.Players.LocalPlayer
local Container = script.Parent.Parent:WaitForChild("Container")

script.Parent.MouseButton1Click:connect(function()
    Container.Visible = not Container.Visible
end)

1 comment

0

what was the point of putting player lol

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