local light = script.Parent.Parent.Parent.Body.Li game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key) if key == "z" then light.Lamp.Lighto.Light.Visible = true else light.Lamp.Lighto.Light.Visible = false end end) game.Players.LocalPlayer:GetMouse().KeyUp:connect(function(key) if key == "z" then light.Lamp.Lighto.Light.Visible = true else light.Lamp.Lighto.Light.Visible = false end end)
i have a picture to https://gyazo.com/3e6a07a3f427c5ab97c84b1848cbcd94 and https://gyazo.com/637b682a109629f07e12158c6786a5ea
Mouse.KeyDown is deprecated, use UserInputService. It is much better it can be found on the wiki.
like this?
local light = script.Parent.Parent.Parent.Body.Li game.Players.LocalPayer:UserInputServer().InputBegan:connect(function(key) if key == "z" then light.Lamp.Lighto.Light.Visible = true else light.Lamp.Lighto.Light.Visible = false end end) game.Players.LocalPlayer:UserInputServer().InputBegan:connect(function(key) if key == "z" then light.Lamp.Lighto.Light.Visible = true else light.Lamp.Lighto.Light.Visible = false end end)