I’m trying to make an emote menu, most of It worked, but I recently converted the script into a local script and normal script controlled by remote emotes and now for some reason when its on the actual player’s screen it only does the animation 1 time, but when I switch to the current client option, it is looping and doesn’t stop looping. Every time I re-click the button, the animation gets faster but nobody can see the animations in the actual games.
My LocalScript:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local frame = script.Parent.ScrollingFrame
local playing = false
local event = game.ReplicatedStorage.EmotesController
local debounce = false
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
for i, v in pairs(frame:GetChildren()) do
if v:IsA("ImageButton") then
v.MouseButton1Click:Connect(function()
if playing == false and debounce == false then
debounce = true
event:FireServer(v.Animation, "Play")
playing = true
wait(3)
debounce = false
elseif playing == true and debounce == false then
debounce = true
event:FireServer(v.Animation, "Stop")
playing = false
wait(3)
debounce = false
end
end)
end
end
My serverscript:
event.OnServerEvent:Connect(function(player, anim, action)
if action == "Play" then
local char = player.Character
local hum = char.Humanoid
local emote = hum:LoadAnimation(anim)
hum.WalkSpeed = 0
hum.JumpPower = 0
emote.Looped = true
emote.Priority = Enum.AnimationPriority.Action
emote:Play()
elseif action == "Stop" then
local char = player.Character
local hum = char.Humanoid
local emote = hum:LoadAnimation(anim)
hum.WalkSpeed = 16
hum.JumpPower = 50
emote.Looped = false
emote:Stop()
end
end)