I’m trying to make emotes for my game, but I have the issue that the player will slide across the ground very slowly whenever an emote is being played.
Right now, I have it so that when the emote is being played, walk speed and jump power is set to 0 both, so that they can’t move. That part does work fine, but on some of the emote’s animations they are a bit low to the ground and their movement slowly moves the player on the terrain.
The only ‘solution’ I found was to anchor the humanoid root part, but the problem is that I don’t want players to jump and then use the emote to essentially float, and I also don’t want players to try to “stack” up to higher spots using it. (Of course I wouldn’t mind anchoring the humanoid root part if there is a fix for those issues)
Here’s the emotes local script (there’s more after it but it’s irrelevant since it’s just more emotes then just the sit):
local EmotesFrame = script.Parent
local innerFrame = EmotesFrame.InnerFrame
local innerFrame2 = innerFrame.Frame
local Input = game:GetService("UserInputService")
local module = require(game.ReplicatedStorage.Variables)
local player = game.Players.LocalPlayer
local human = player.Character:WaitForChild("Humanoid")
module.animated = false
module.animatable = true
innerFrame.Back.MouseButton1Click:Connect(function()
EmotesFrame.Visible = false
end)
player.CharacterAdded:Connect(function()
module.animated = false
end)
--turn off or on emotes when this is called
game.ReplicatedStorage.Speed.OnClientEvent:Connect(function(ifanimate)
if ifanimate == false then
module.animatable = false
module.animated = false
elseif ifanimate == true then
module.animatable = true
module.animated = false
end
end)
--Emotes themselves:
--Sit Emotes
innerFrame2.Sit.MouseButton1Click:Connect(function()
if module.animatable == true then
local human = player.Character:WaitForChild("Humanoid")
if module.animated == false then
local human = player.Character:WaitForChild("Humanoid")
local anim = innerFrame2.Sit.Animation
human.WalkSpeed = 0
human.JumpPower = 0
game.ReplicatedStorage.Animation:FireServer(anim, module.animated)
module.animated = true
else
local human = player.Character:WaitForChild("Humanoid")
local anim = innerFrame2.Sit.Animation
human.WalkSpeed = 16
human.JumpPower = 50
game.ReplicatedStorage.Animation:FireServer(anim, module.animated)
module.animated = false
end
end
end)
And here’s the serverside script so other players can see the animation too:
game.ReplicatedStorage.Animation.OnServerEvent:Connect(function(player, animation, animated)
local anim
if animated == false then
local character = player.Character
local human = character:WaitForChild("Humanoid")
anim = human:LoadAnimation(animation)
anim:Play()
else
local character = player.Character
local human = character:WaitForChild("Humanoid")
for _,thisTrack in pairs (human.Animator:GetPlayingAnimationTracks()) do
thisTrack:Stop()
end
end
end)