For some weird reason my character keeps twitching while the standing animation starts. Not sure why this is happening at all, the first animation has 0 twitching/errors.
Here’s the code i’m using:
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://17110926023"
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local standanim = Instance.new("Animation")
standanim.AnimationId = "rbxassetid://17120493718"
local LoadedStand = animator:LoadAnimation(standanim)
local LoadedAnimation = animator:LoadAnimation(animation)
local UserInputService = game:GetService("UserInputService")
local eventRecieved = false
game.ReplicatedStorage.WaterTouched.OnClientEvent:Connect(function()
eventRecieved = true
end)
UserInputService.InputBegan:Connect(function(input,gameProcessedEvents)
if input.KeyCode == Enum.KeyCode.V and eventRecieved then
local Plr = game.Players.LocalPlayer
local ThirstVal = Plr:WaitForChild("ThirstVal")
print("RemoteEvent Activated") --checking if code worked/eventfired
LoadedAnimation:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
task.wait(5.6)
ThirstVal.Value = 100
LoadedAnimation:Stop()
LoadedStand:Play()
task.wait(1.3)
LoadedStand:Stop()
hum.WalkSpeed = 16
hum.JumpPower = 50
end
end)