So I have this “computer” (really just a block with a SurfaceGui) and the point of my script is that if the correct code is entered, the monitor will become slightly transparent. The issue is when I try to enter the code to make the monitor transparent in Play Solo mode, clicking the numbers on the numpad does…nothing. But, when I do it in Run mode, it works perfectly fine.
The following script is from a free model code door that I edited to be used on a ScreenGui.
Activated is meant to work cross-platform, while MouseButton1Click(I assume) only works with a mouse&keyboard setup (which is 99% of the time only PC).
I’m not sure why the latter works in this case but the former doesn’t, because as far as I knew, SurfaceGui button presses were replicated to the server. Just in case they aren’t though, it may be worthwhile to put it in a LocalScript instead and have a second server Script in ServerScriptService to catch events. Maybe this way you’d still be able to use Activated?
local TheCode = "4958"
local Input = ""
local Btns = game.Workspace.Monitor.SurfaceGui.Frame
Input = ""
if Input == TheCode then
workspace.Monitor.Transparency = .7
Input == ""
for i,v in pairs(Btns:GetChildren()) do
if string.sub(v.Name, 1, 1) == "N" then
local Add = string.sub(v.Name, 2, #v.Name)
Input = Input..Add
When scripting, Instead of writing things out manually, You can make an automatic system.
Also also, I’d like to mention, you used return and honestly that wasn’t necessary, You can just use else as I did above.
Yeah, then your best bet would definitely be a LocalScript that catches the .Activated events and transmits the necessary information via RemoteEvents to a separate script somewhere else (ServerScriptService would be best imo).
Let me know if this works, as I haven’t done any testing.