So basically, I was in a game that had a /sync command. With this command, you could sync the dance with another one. For Example: /sync UserXYZ. Then, you would sync with that User. Now the question is, how can I create such a command?
How to create /sync command?
1 answer
To make a command you will need to use the player.Chatted event and :split() method.
local player = game.PLayers.LocalPlayer
player.Chatted:Connect(function(message)
local chatTable = message:split(" ") --//Will split the message everytime it spots a space looks like this {"/sync", "Player1"}
if chatTable[1] = "/sync" then
local playerName = chatTable[2]
--//Now we know what player to sync with
end
end)
This is how to make the command and how to know what player to sync with.
6 comments
Thanks @kingblaze_1000 for your answer!
No Problem @TheDoorToTheLion I hop it helped you.
Wait where do I have to put that script or is it a localscript? Because it doesn't seem to work, do I have to add something?
It is a local script. You can't use game.Players.LocalPlayer in a server script
Also maybe put it in StarterPack. If you don't know where local scripts will work then they work in the starter things i.e. starter character or starter Gui
It still doesn't work sadly... I don't have to add anything else? Just put this text into a Localscript and put that script into the Startpack?
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
is it r6 or r15?
R15. The dances are R15.