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

Why isn't my GUI script working? Do I need a remote event?

This is my script and for some reason idk why it doesn't work. ( btw its for a text button, and dont question the "Nights" )

game.StarterGui.Nights.Night1.MouseButton1Down:Connect(Night1)

3 comments

0

And the "Nights" after StarterGui is a renamed screen GUI if thats helpful

0

ahhhh ok thank you

1 answer

So I think this would help. Put a local script in your button, and write this code.

local shopframe = script.Parent.Parent.ShopFrame

script.Parent.MouseButton1Click:Connect(function()
     --your code here
     --If you are making a shop, make the frame visible.
     if shopframe.Visible == false then
     shopframe.Visible = true
     elseif shopframe.Visible == true then
     shopframe.Visible = false
     end --This will make it so you can click to close it and open it.
end)

Now if you wanna fire a remote event, you would access the place where you put your remote event:

local re = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1Click:Connect(function(Night1)
       re:FireServer()
end)

Then you would make a script inside ServerScriptService.

local re = game.ReplicatedStorage.RemoteEvent

re.OnServerEvent:Connect(function()
     --code here
end)

If theres anything else, ask right away.

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