This only works when used as a local script and in Starter GUI. I'm trying to make it work when you execute the script alone. I'm wondering can you take the script and execute itself and work. I am having trouble. Please help.
player = script.Parent.Parent crawling = true local char = player.Character local origin = char:WaitForChild("HumanoidRootPart") local ignore = { char, char.Torso, char.HumanoidRootPart } local mouse = player:GetMouse() local wKey = false local aKey = false local dKey = false local sKey = false local canCrawl = true local human = char:WaitForChild("Humanoid") mouse.KeyDown:connect(function(key) if key == "w" then wKey = true elseif key == "d" then dKey = true elseif key == "s" then sKey = true elseif key == "a" then aKey = true end end) mouse.KeyUp:connect(function(key) if key == "w" then wKey = false elseif key == "d" then dKey = false elseif key == "s" then sKey = false elseif key == "a" then aKey = false end end) function endCrawl() if crawling then canCrawl = false human.PlatformStand = false human:ChangeState(Enum.HumanoidStateType.PlatformStanding) human.Jump = true end origin.Anchored = false if crawling then human.Jump = true wait() human.Jump = true wait() human.Jump = true crawling = false end wait(0.3) canCrawl = true end function startCrawl(normal) crawling = true origin.CFrame = CFrame.new(origin.CFrame.p, origin.CFrame.p - normal) origin.Anchored = true human.PlatformStand = true end while wait() do local checkFront = Ray.new(origin.CFrame.p, origin.CFrame.lookVector.unit * 1.2) local hit, position, normal = workspace:FindPartOnRayWithIgnoreList(checkFront, ignore) local checkDown = Ray.new(origin.CFrame.p, Vector3.new(0, -2.8, 0)) local dHit, dPosition = workspace:FindPartOnRayWithIgnoreList(checkDown, ignore) if hit and canCrawl then if not dHit then if hit.Anchored == true and hit.CanCollide == true then startCrawl(normal) else endCrawl() end elseif dHit.CanCollide == true then endCrawl() end else endCrawl() end if crawling then if wKey then origin.CFrame = origin.CFrame * CFrame.new(0, 1, 0) elseif sKey then origin.CFrame = origin.CFrame * CFrame.new(0, -1, 0) elseif aKey then origin.CFrame = origin.CFrame * CFrame.new(-1, 0, 0) elseif dKey then origin.CFrame = origin.CFrame * CFrame.new(1, 0, 0) end end end