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

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

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)

1 comment

0

it looks like you are getting the mouse but then using keydown. You should use userinputservice for keypresses.

1 answer

✓ Accepted answer

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.

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