0

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 — 9mo

0
Edited 9 months 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.