I have a script, I edited it from a free model.. I added in the codes after it shows "e" and I changed it from (Player = script.Parent.Parent) to (Players = Players.LocalPlayer) Is that right?. Can someone please help? I want it so when someone presses E they can either toggle from FPS mode to classic and press again to change from classic to FPS. And I left the original author there to show I didn't EXACTLY create it..
Players = Players.LocalPlayer mouse = Players:GetMouse() function onKeyDown(key) key = key:lower() if Players.LocalPlayer.Open.Value == false then if key == "e" then --start game.StarterPlayer.CameraMode.LockFirstPerson = false game.StarterPlayer.CameraMode.Classic = true end elseif Players.LocalPlayer.Open.Value == true then if key == "e" then --E is the key to open and close game.StarterPlayer.CameraMode.Classic = false game.StarterPlayer.CameraMode.LockFirstPerson = true end end end mouse.KeyDown:connect(onKeyDown) --IciFlame
If you are doing a LocalPlayer you must make the script in a local script. Also, regarding the Player = Players.LocalPlayer. That should be
local Player = game.Players.LocalPlayer
The function should also be
function onKeyDown(key) key = key:lower() if Player.Open.Value == false then if key == "e" then --start game.StarterPlayer.CameraMode.LockFirstPerson = false wait() game.StarterPlayer.CameraMode.Classic = true end elseif Player.Open.Value == true then if key == "e" then --E is the key to open and close game.StarterPlayer.CameraMode.Classic = false wait() game.StarterPlayer.CameraMode.LockFirstPerson = true end end end
Remember this HAS to be in a LocalScript.