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

i did like gui on a letter but it dint work please help?

Asked by
frjhue 2
2 years ago

i wanna do that will do it when clicket again it should go the visible false but it dint i put here the one wath i tried

local Plr = game.Players.LocalPlayer

Plr:GetMouse().KeyDown:Connect(function(M) if M == "m" then script.Parent.Visible = true if Plr:GetMouse().KeyDown:Connect(function(M) then script.Parent.Visible = false end) end end end)

0
it looks like you are getting the mouse but then using keydown. You should use userinputservice for keypresses. piggy0129 2 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I assume your script means that it toggles a part of the GUI when M is pressed:

local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()

Mouse.KeyDown:Connect(function(Key)
    if Key == "m" then
        script.Parent.Visible = not script.Parent.Visible
    end
end)

Make sure you also do this in a LocalScript or it won't work.

Ad

Answer this question