Enum KeyCodes Not Working (ServerScript) [OverheadGUI Frame Visibility Toggle Script]

alright great but also send the code we are working with because its obviously changed since the original post.

Here’s the ServerScript.

--Add this and replace the line of the server UserInputService
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("YourRemoteName")

Remotes.OnServerEvent:Connect(function(player) --First param is player that fires the remote
    clonedgui.Frame.Visible = not clonedgui.Frame.Visible
end)

that all looks fine now lets move on to the server sript side of it (so show me the server script bit)

Just sent the serverscript, you can check!

Uh oh seems that I accidentally edited it, do you want me to resend the localscript?

alright first of all we need to change the “YourRemoteName” to “VisibilityEvent”

we also need to define what cloned GUI is

1 Like

Yes I know that, I copied it from the previous posts and I changed it in the actual script.

The thing is that the current script is working but it removes or hides everybody’s GUI.

alright imma just write all the code out for you so you can copy it into your game give me a minute or two

1 Like

alright try this out

--Add this and replace the line of the server UserInputService
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("VisibilityEvent")

Remotes.OnServerEvent:Connect(function(player) --First param is player that fires the remote
	local ClonedGui = game.Workspace:WaitForChild(player.Name, 10).Head.OverheadGui
	if ClonedGui.Frame.Visible == false then 
		ClonedGui.Frame.Visible = true
	else
		ClonedGui.Frame.Visible = false
	end
end)

make sure this is in a server script!

1 Like

Alright, will do. It’ll work even if I make a new ServerScript into the SSS and not necessarily the Overhead GUI script, is that correct?

server script - that puts all the guis in everyones head - goes into “ServerScriptService”

local script - that detects a key pressed then fires the event - goes into “StarterPlayerScripts”

server script - that actually makes the frame visible/invisible (the one i just wrote for you) - goes into “ServerScriptService”

and that should be all there is to it

1 Like

Alright, I’ll test this out! Thank you for replying.

no problem if there are any errors ill happily debug them for you :+1:

1 Like

Thank you, it worked.

Sorry for testing it a bit late, I couldn’t access studio at the time (was on mobile) so I just asked another developer to test it out for me. Thank you so much, and if I find bugs in the future, I’ll let you know.

wonderful always happy to help :+1:

1 Like