Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can't get msg:chatted working?

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)

1 comment

0

Helping out yumtaste here, you're missing a normal "end" after line 7. Feel free to upvote this if it helped. He did answer your question though.

1 answer

✓ Accepted answer

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)

2 comments

0

Oh, ok will try and report back, thanks.

0

"game.Players.PlayerAdded:connect(function(pla..."]:8: unexpected symbol near ')' is what I get.

This discussion is preserved as it was. New answers, comments, and votes are closed.