my local script
local plr = game:GetService("Players").LocalPlayer local Mouse = plr:GetMouse() local cas = game:GetService("ContextActionService") local function onEPress(name, state, input) if state == Enum.UserInputState.Begin then game.ReplicatedStorage.RemoteEvent1:FireServer() end end cas:BindAction("ePressed", onEPress, false, Enum.KeyCode.E) -- basically when E is pressed, onEPress runs.
My script
game.ReplicatedStorage.RemoteEvent1.OnServerEvent:Connect(function() -- Any code in here will run when RemoteEvent is triggered script.Parent.Transparency = 0.5 end)
Hello RainbowBeastYT, you do not need remote event to open gui. The server should not have to know of this let alone handle gui. It's good to do it on the local script and there only because it causes less lag. Unless if you press the button all players should see it but that will be annoying to the players that try playing your game.
local plr = game:GetService("Players").LocalPlayer local Mouse = plr:GetMouse() local cas = game:GetService("ContextActionService") local function onEPress(name, state, input) if state == Enum.UserInputState.Begin then script.Parent.BackgroundTransparency = 0.5 end end cas:BindAction("ePressed", onEPress, false, Enum.KeyCode.E) -- basically when E is pressed, onEPress runs.
Hello,
--Start function doStuff() --insert code you want to do here end game:GetService("ContextActionService"):BindAction("ExecuteCode", doStuff, false, "f") --if F is pressed it will run the doStuff() --End
~Frag