Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm trying to make the player not be able to go backwards only forwards but it's not working?

Asked by 5 years ago

I don't want the player not to be able to go backwards only forwards but my code isn't working.

(Output) : ServerScriptService.script:1: attempt to index a nil value

My code:

local Hum = game.Players:GetPlayerFromCharacter(nil).Character.HumanoidRootPart



while true do

if Hum.Orientation == Hum.Orientation.Unit(0, 163.57, 0) or Hum.Orientation == Hum.Oriention.Unit(0, 54.64, 0) then

Hum.Orientation = Hum.Orientation.Unit(0, 0, 0)

wait(0.1)

end

end
0
I think you should force their camera face forward and make the back button s nil extremeparkrider 0 — 5y
0
+extremeparkrider I would make the camera attached and to not be able to use the "s" key you use userinputservice?? Freddan2006YT 88 — 5y
0
I wouldn't recommend usi it is really complicated right now I am trying to learn how it's done myself will get back to you I've come as for as context action service but filtering enabled places also pose another layer of learning barrier e.e extremeparkrider 0 — 5y
0
as far as my research we may need to negate the action of back through a control script but I could be wrong extremeparkrider 0 — 5y
0
I have seen people use a input code and have walkspeed in humanoid set to zero on every s key and walkspeed normal every other event. sorry for my bad english. extremeparkrider 0 — 5y

Answer this question