I haven't figured out what is going wrong in my game and I've been searching for about 2 hours now and I can't figure anything out. I have a click detector set up to a Screen GUI that works in studio but will NOT work in game. I don't know what the problem is and I really need this to work
When I use play here it works fine but when I use the local server option it doesn't and there is nothing in the F9 menu that tells me about it.
I have a regular script running the screen gui where it opens the frame while there is a local script running the close button. I believe there is nothing wrong with the local script so i'm just going to include the normal script.
Here is my code.
local function click(player)
player.PlayerGui.Paper1ScreenGui.Frame.Visible = true
end
script.Parent.ClickDetector.mouseClick:connect(click)
I don't know why it's jumbled up but I don't think that matters all too much. This is my first time asking a question on here. One other thing, I also want this to work for just one player when they click it so it'll only show up on that one player's screen when you he/she clicks it
LocalScript
s may access things like ServerStorage
or Script
s accessing LocalPlayer
. Use local servers instead, as clients and server are separated there.PlayerGui
unless placed by it. But the server shouldn't be touching that anyway. You will need a RemoteEvent
.-- LocalScript under your Frame local remote = game:GetService("ReplicatedStorage").ShowGui -- I named it ShowGui, name it whatever tho remote.OnClientEvent:Connect(function() script.Parent.Visible = true end)
local remote = game:GetService("ReplicatedStorage").ShowGui local function click(player) remote:FireClient(player) -- player is the client to fire to end script.Parent.ClickDetector.MouseClick:Connect(click)
mouseClick
and connect
are deprecated, use MouseClick
and Connect
instead.