Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gui functions and keydown functions not doing anything at all?

Pretty simple to understand ; I have a seat in a boat ; I have the boat in a huge transparent block with cancollide off and anchor on . when you enter the block it checks if ur seated then if u are pops up a Gui and if you press e while it is on screen it dissapears and pops a new gui.. you can see the script ;

--// Variables \\--

local part = script.Parent

local plr = game.Players.LocalPlayer

local mouse = plr:GetMouse()

local f = false

local t = true

--gui variables

local eGui = game.StarterGui.pressEgui.eGui

local basic = game.StarterGui.ChooseDifficulty.BasicButton

--// Actions \\--

  

part.Touched:Connect(function()

if plr.Seated == t then

eGui.Visible = t

end

end)

  

mouse.KeyDown:Connect(function(Key)

if Key == "e" then

basic.Visible = t

end

end)

  

basic.MouseButton1Click:Connect(function()

basic.Visible = f

end)

if u need any more info to reslove my issue please comment nothing in output comes up :/

1 comment

0

key down is bad use user input service

1 answer

✓ Accepted answer

Your gui variables seems to be wrong which is line #15 and #17, You stored a service which is StarterGui in both variables. So it is changing the visibility of your eGui in the service not locally. So, store game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui") so it would change locally.

2 comments

1

Along with this answer, local scripts don't work in the workspace, so you can either move your script to StarterPlayerScripts and redefine your variables or use a remote event

0

Agreed. ++

This discussion is preserved as it was. New answers, comments, and votes are closed.