Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gui functions and keydown functions not doing anything at all?

Asked by
AltNature 169
5 years ago

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 :/

0
key down is bad use user input service User#24403 69 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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.

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 MegaManSam1 207 — 5y
0
Agreed. ++ NickAtNick 163 — 5y
Ad

Answer this question