hello i have a crawl script and i want to make it where if someone has a tool equipped there crawl will be a little slower and a different animation will play but i can not get it any help? i made it where if someone equips a tool then a value in the script will go true
if key.KeyCode == Enum.KeyCode.C then
if not isRunning then -- Crawling
Humanoid.WalkSpeed = 10
isRunning = true
humanoid1.CameraOffset = Vector3.new(0, -1, -1.8)
Anim:Play()
Anim:AdjustSpeed(0)
print("Crawling")
elseif isRunning then -- Walking
Humanoid.WalkSpeed = 16
Anim:Stop()
isRunning = false
print("Running")
humanoid1.CameraOffset = Vector3.new(0, 0, -0.59)
else
if script.EquippedTool.Value == true then
if not isRunning then
print("CrawlWitTool")
Humanoid.walkSpeed = 7
Anim:Stop()
ToolAnim:Play()
end
end
end
end
end)
if key.KeyCode == Enum.KeyCode.C then
if script.EquippedTool.Value == true then
if not isRunning then
print("CrawlWitTool")
Humanoid.walkSpeed = 7
Anim:Stop()
ToolAnim:Play()
end
else
if not isRunning then -- Crawling
Humanoid.WalkSpeed = 10
isRunning = true
humanoid1.CameraOffset = Vector3.new(0, -1, -1.8)
Anim:Play()
Anim:AdjustSpeed(0)
print("Crawling")
elseif isRunning then -- Walking
Humanoid.WalkSpeed = 16
Anim:Stop()
isRunning = false
print("Running")
humanoid1.CameraOffset = Vector3.new(0, 0, -0.59)
end
end
end
end)
It still doesn’t work and it’s pretty buggy, when u pull it out while crouching it doesn’t slow the player down, if u try to get up while holding a tool it doesn’t allow you to, it only allows u to stand up with no tool
make sure set the EquippedTool.Value = false when tool is unequipped
try this code Tool.Unequipped:Connect(function() script.EquippedTool.Value = false end)
function CrawlingTool()
script.Parent.HumanoidRootPart.CanCollide = false
Humanoid.HipHeight = -1.9
humanoid1.CameraOffset = Vector3.new(0, -1, -1.8)
Humanoid.WalkSpeed = 7
Anim:Stop()
ToolAnim:Play()
end
function Crawling()
script.Parent.HumanoidRootPart.CanCollide = false
Humanoid.HipHeight = -1.9
humanoid1.CameraOffset = Vector3.new(0, -1, -1.8)
Humanoid.WalkSpeed = 10
Anim:Play()
ToolAnim:Stop()
Anim:AdjustSpeed(0)
end
function StandingUp()
script.Parent.HumanoidRootPart.CanCollide = true
Humanoid.HipHeight = 0
humanoid1.CameraOffset = Vector3.new(0,0,-0.59)
Humanoid.WalkSpeed = 16
Anim:Stop()
ToolAnim:Stop()
end
-- Short cut functions End --
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C then
if script.EquippedTool.Value == true then
if not isRunning then -- This is crrawling but with a tool equipped
isRunning = true
print("CrawlWitTool")
CrawlingTool()
else
isRunning = false
print("Running")
StandingUp()
end
else --- If No Tool is equipped/This is regular Crawling
if not isRunning then -- Crawling
isRunning = true
Crawling()
print("Crawling")
elseif isRunning then -- Walking
isRunning = false
StandingUp()
print("Running")
end
end
end
end)
“Advanced Flashlight” btw am I gonna have to put everytime tools name into this script? Cuz my games gonna have alot of tools so that is kinda gonna be annoying
Or could I make it where in the script of the flashlight I make it where it makes a value inside the script the name of the tool so I wouldn’t have to define each tool?