hi, im making emotes for my game, and i change it to client, basicly
server shoots a string value, client process the value,
plays emotes.
simple right???
but theres a problem, because is client, i have to check who is doing the emote, specially if i want to use remote events, wich is important too.
now i fixed that ofc, but i notice that other clients sees you playing the emote 2 times, but the client that is doing the emote, just did it once.
like it says on the tittle.
so im confused of how i solved this?:
heres the function that plays the animation:
function module.playEmote(char: Model, emoteName: string)
local data = EmoteCache[char]
if not data then return end
local plr = Players:GetPlayerFromCharacter(char)
local track = data.Tracks[emoteName]
if not track then
warn("Emote not preloaded:", emoteName)
return
end
local Anbimation = data.AnimationsC[emoteName]
if not Anbimation then
warn("Emote Not Animation:", emoteName)
return
end
local Owner = (plr == Players.LocalPlayer)
local Velocity = 0
if Anbimation:FindFirstChild("Velocity") then
Velocity = Anbimation:FindFirstChild("Velocity").Value
else
Velocity = 0.05
end
if data.Current then
data.Current:Stop()
end
if valuestop[char.Name] then
if Owner then
BasicRemote:FireServer({Action = "AttackDestroy"})
end
end
valuestop[char.Name] = true
if Owner then
data.Current = track
track:Play()
char:SetAttribute("DoingEmote", true)
BasicRemote:FireServer({Action = "AttackD", walkspeed = Velocity, jumpforce = 0})
end
task.spawn(function()
for i, v in pairs(Anbimation:GetChildren()) do
if v:IsA("ModuleScript") and v.Name == "Function" then
local scrippt = require(v)
scrippt.Act(track, char)
end
end
end)
track.Ended:Connect(function()
if data.Current == track then
data.Current = nil
end
task.wait(0.1)
if not data.Current and valuestop[char.Name] then
valuestop[char.Name] = nil
char:SetAttribute("DoingEmote", nil)
if Owner then
BasicRemote:FireServer({Action = "AttackDestroy"})
end
end
end)
end
this line is what im talking about that changes everything:
if Owner then
data.Current = track
track:Play()
char:SetAttribute("DoingEmote", true)
BasicRemote:FireServer({Action = "AttackD", walkspeed = Velocity, jumpforce = 0})
end
without change it:
(it supposedly be drinking a gasoline thingy)
if i take out the play track:
track:Play()
if Owner then
data.Current = track
char:SetAttribute("DoingEmote", true)
BasicRemote:FireServer({Action = "AttackD", walkspeed = Velocity, jumpforce = 0})
end
(i forgot to put away the “data.Current = track”, but if you can see it plays 2 times)
how i make play the animation, without playing 2 times in other clients, and still be able to see the vizuals across all clients?
