Hey there! I am a lua scripter here, and I need help from you guys to see if this would work (Studio not working) and this a night vision script. I made this more realistic by adding a gui that's green and the night vision can be accessed by KeyDown event, and there's a object on the player's head that turns the ambient to 20 and the color of it to lime green (or whatever it is) any ways, here it is (Note, this is a local script)
Repeat wait () until game.Players.LocalPlayer Local p = game.Players.LocalPlayer--P is for player Local m = p:GetMouse--m stands for mouse Local folder = p.PlayerGui:WaitForChild("Night Vision Gui")-- Name of gui for night vision m.KeyDown:connect(function(key) If key: lower() == "N" then--N for night vision Game.Player.NightVisionGear Game.StarterGui.Visible then game.StarterGui.NightVisionGui.Visible = False Game.Player.NightVisionGear.Ambient = 0 Else Game.StarterGui.NightVisionGui.Visible = True Game.Player.NightVisionGear.Ambient = 20 End end) end)
Please tell me if something is wrong, and edit this or write the one easier than this. Thanks!
There are a number of errors in your script. I have tried to address them all below (see my comments), but I may have missed some. If you continue to have problems, be certain you have the Output window visible in Roblox Studio (View/Output Window) and include any error messages you receive in follow-up questions.
repeat wait() until game.Players.LocalPlayer --repeat must be lowercase local p = game.Players.LocalPlayer -- local must be lowercase local m = p:GetMouse() --you must invoke GetMouse local folder = p.PlayerGui:WaitForChild("Night Vision Gui")-- Name of gui for night vision m.KeyDown:connect(function(key) if key:lower() == "n" then --'if' must be lowercase, comparing to a capital letter will always return false. You want to compare to lowercase letter game.Player.NightVisionGear --this line does nothing at all. Not sure what your intent is if game.StarterGui.NightVisionGui.Visible then --missing 'if'; StarterGui has no Visible property. What is your intent here? My guess is you meant game.StarterGui.NightVisionGui.Visible game.StarterGui.NightVisionGui.Visible = false --false must be lowercase game.Player.NightVisionGear.Ambient = 0 --choose Game or game and stick with one ;) else --else must be lowercase game.StarterGui.NightVisionGui.Visible = true --true must be lowercase game.Player.NightVisionGear.Ambient = 20 end --end must be lowercase end --no close parenthesis required here end)