When the player comes in contact with the brick, he will have 3 seconds to climb the obstacle. If he doesn't make it in time, his player will sit down and fall. However, once he falls down he can get up and climb again. How can I make this so that the player sits down, then has to wait 5 seconds before getting up.
Also, another thing if possible make the script work once every 30 seconds because if the player moves inside the brick, it makes the script run 3 times instead of one and he keeps sitting over and over.
function OnTouched(part) local humanoid = part.Parent:FindFirstChild("Humanoid") print("3 SECONDS LEFT TO DO WARPED WALL") wait(1) print("2 SECONDS LEFT TO DO WARPED WALL") wait(1) print("1 SECONDS LEFT TO DO WARPED WALL") wait(1) print("You've failed!") wait (0) if (humanoid ~= nil) then humanoid.Sit = true end end script.Parent.Touched:connect(OnTouched)
local ClimbTime = 3 local StandTime = 5 local function StartedClimbing(Climbing) local Humanoid = Climbing.Parent:FindFirstChildOfClass("Humanoid") if (Humanoid) then wait(ClimbTime) if (Humanoid:GetState() == Enum.HumanoidStateType.Climbing) then Humanoid.PlatformStand = true wait(StandTime) Humanoid.PlatformStand = false end end end script.Parent.Touched:Connect(StartedClimbing)
--//Variables local player = game:GetService("Players").LocalPlayer; local userInputService = game:GetService("UserInputService"); local timeLimit, canJump = 3, true; local finished = false; --//Events userInputService.JumpRequest:Connect(function() if player.Character then local humanoid = player.Character:FindFirstChild("Humanoid"); if humanoid then humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, canJump); --Cancel jump if they can't jump, or let them jump end; end; end); local deb = true; workspace:FindFirstChild("ClimbStart").Touched:Connect(function(hit) if deb then deb = not deb; local character = player.Character; if character then if hit.Parent == character then delay(timeLimit, function() if not finished then canJump = false; local h = character:FindFirstChild("Humanoid"); if h then h.Sit = true; end; wait(timeLimit); canJump = true; if h then h.Sit = false; end; end; end); end; end; deb = not deb; end; end); workspace:FindFirstChild("ClimbDone").Touched:Connect(function(hit) --Green block local character = player.Character; if character then if hit.Parent:IsA("Model") and hit.Parent == character then finished = true; end; end; end);