Recently playing some games on Roblox and I notice this game called Subway Mayhem has an emote sync feature. Where if you do the same emote as someone else, it automatically syncs up, doesn’t matter if they’re at the start, middle or end.
Anyone know a way to achieve something like this? I’m trying to get it into one of my group games with emotes so I think it’d be cool for something like this as well.
I was just looking though the documentation here and there is a propertity called Time position and like what @jellolemo said look at every player to see if they are playing the animation that the player is trying to play. Then get the make the track like normal get the timeposition of the player who is already playing it and set the track you just made time position to that other track already playing.
code example if you don’t get completely I mean
local function PlayingTrack(hum, Track)
local PlayingTracks = hum:GetPlayingAnimationTracks()
for _, track in PlayingTracks do
if track.Name == Track then
return true, track.TimePosition
end
end
return false, 0-- 0 is to use one less if statment
end
end
local function CheckForAlreadyPlaying(Animation)
for _, Player in game.Players:GetPlayers() do
local hum = Player.Character.Humanoid
local Playing, TimeStamp: boolean, number = PlayingTrack(hum, Animation.Name)
return Playing, TimeStamp
end
end
-- some player wants to run an animation you run CheckForAlreadyPlaying function
-- before you make track using the animation instance then you make the track
--and set the time position to Timestamp (not inside of CheckForAlreadyPlaying function tho that for return the time stamp and if it already playing)
this may not work because I’m not at my computer rn so this is all from the top of my head.
Ive made the game you are talking about. We check nearby players and scan through thier playing tracks (Humanoid:GetPlayingAnimationTracks) for the same id and then sync to thier time position. Scanning is done on client, server only recieves the player they are syncing to.
EDIT: The reply above pretty much explained everthing, though we make every client ingame also forcefully sync audio.