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

[FE] Text Button that makes a frame visible wont work online but in studio it works?

Asked by
RootEntry 111
6 years ago

I am trying to make a tycoon, well I have a button that makes a frame visible. The script is FE.

ClientSide Script:

script.Parent.MouseButton1Click:connect(function()
    game:GetService("ReplicatedStorage").Events.OpenBuildTab:FireServer()
end)

ServerSide Script:

game:GetService("ReplicatedStorage").Events.OpenBuildTab.OnServerEvent:connect(function(player)
    player:WaitForChild("PlayerGui"):WaitForChild("HUD").BuildTab.Visible = true
end)

I do not get any errors in online and studio play. It works in studio but dosen't work online.

0
Why don't you use only a Local Script? Leamir 3138 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

To toggle the visibility of a GuiObject, no RemoteEvents are needed at all!

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Enabled = not script.Parent.Parent.Enabled 
    -- Assuming the textbutton’s parent is a screengui
end)
Ad

Answer this question