This is my code, I want it to set the vehicle speed to "200" when I chat go and to "0" when I chat stop, can't understand why this doesn't work.
game.Players.PlayerAdded:connect(function(player) if player.Name == "Player" then player.Chatted:connect(function(msg) if msg == "go" then game.Workspace.xTranquil.Taxi.VehicleSeat.MaxSpeed = "200" elif msg == "stop" then game.Workspace.xTranquil.Taxi.VehicleSeat.Maxspeed = "0" end) end end)
Lol on line 6 it says elif
. I'm sure you meant elseif
. That looks like the only error to me.
EDIT: I can't explain it, so I'm going to fix your code and tell you what I changed.
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if player.Name == "Player" then if msg == "go" then game.Workspace.xTranquil.Taxi.VehicleSeat.MaxSpeed = "200" elseif msg == "stop" then --fixed that spelling mistake game.Workspace.xTranquil.Taxi.VehicleSeat.Maxspeed = "0" end --i added this end end --moved the ) to the end below this one end) end)