NOTE: Before trying the method 2, try method 1 first.
Method 1:
Try doing it all in one single Local Script.
Try something like this:
Frame = (Frame location here)
clickDetector = (Click detector location here)
function onMouseClick()
Frame.Visible = true -- Or false
end
clickDetector.MouseClick:connect(onMouseClick)
I think the problem might be with using âMouseClickButton1Clickâ instead of âMouseClickâ. From what I remember, âMouseClickButton1Clickâ is only for buttons, not click detectors. Read more about it in the link directly below this.
Good guide if you wanna check it out: https://developer.roblox.com/en-us/api-reference/class/ClickDetector
Method 2:
You could try this:
Have 1 Localscript that says this:
clickDetector.MouseClick:Connect(function()
RemoteEvent:FireServer()
end)
Then have one server script in ServerScriptService that says something like:
RemoteEvent.OnServerEvent:Connect(function(player)
RemoteEvent:FireClient(player)
end)
And then in the same localscript from earlier, put:
RemoteEvent.OnClientEvent:Connect(function()
Frame.Visible = true
end)
Basically what this is doing is,
- When someone clicks the button, the LocalScript fires the RemoteEvent to the Server
- The ServerScript receives the âFireServerâ and fires the RemoteEvent back to the client
- The LocalScript receives the âFireClientâ and does whatever you want it to
Thereâs probably better ways of doing this, but this a starting idea at least, that worked for me. And hereâs something to look at: https://developer.roblox.com/en-us/api-reference/function/RemoteEvent/FireClient
P.S. In the first section of code I sent you, Iâm not sure exactly how to make it fire to that specific player. I just put a âplayerâ parameter in the function and the FireClient. You might have to change that.