So for my game you can sail around and stuff right? and so to run you have to double click w cause it just feels more efficient to me, and when your player runs you gotta have a run anim to fit with it right? so for my game when your in the water (its my own water, it has code but that code doesnt matter) while your floating in it your player when sprinting plays the animation so your running in water also sometimes it doesn’t even go fast when sprinting just plays the animation I really want someone to fix the code cause im a bad scripter
first script:
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local UIS = game:GetService('UserInputService')
local Run = Humanoid:LoadAnimation(script:WaitForChild("Run"))
local S,Word,Running = " ", "W",false
UIS.InputBegan:Connect(function(Input,IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode[Word] then
S = S..Word
end
delay(.3, function()
if S ~= string.rep(Word,2) then S = "" end
end)
if S == tostring(Input.KeyCode):gsub("Enum.KeyCode.",Word) then
Running = true
Run:Play()
Humanoid.WalkSpeed = 32
end
local ChangeEnd = UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode[Word] then
if S ~= Word then Running = false end
end
end)
repeat wait() until Running == false
ChangeEnd:Disconnect()
Run:Stop()
Humanoid.WalkSpeed = 16
end)
second script:
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local UIS = game:GetService('UserInputService')
local LastTapped,Tapped = false,false
local Run = Humanoid:LoadAnimation(script:WaitForChild("Run"))
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.W then
if Tapped == false then
Tapped = true
else
LastTapped = true
Tapped = false
Run:Play()
Humanoid.WalkSpeed = 32
end
delay(.4, function()
if Tapped then
Tapped = false
end
end)
end
end)
UIS.InputEnded:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.W and LastTapped and not Tapped then
Humanoid.WalkSpeed = 16
Run:Stop()
end
end)
please send a fixed version for both