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

How do i make a custom command to start a hockey game?

Asked by 5 years ago

For example I want it to go through the periods but when the goalie saves it the play is stopped same with the time.

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
5 years ago

Hello, Patriq_Kane!

You can use the event game.Players.PlayerAdded to detect player joining, and then, we use plr.Chatted to detect when he/she sends something on the chat

After that, we can add filters to allowing only some players to use the command, and then test if the message is the same as the command

game.Players.PlayerAdded:Connect(function(plr) -- Detects player joining and stores player object at the var "plr"
    plr.Chatted:Connect(msg) -- Detects when a player chats and stores the message to the var "msg"
        if(msg == "startgame")then -- Checks if what player chatted is the command(in this case, startgame)
            --start the game
        end
    end
end)

If I helped, please accept the answer

Ad

Answer this question