Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make this script sit you down, wait 5 seconds, let you get up?

Asked by 5 years ago

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.

01function OnTouched(part)   
02    local humanoid = part.Parent:FindFirstChild("Humanoid")
03    print("3 SECONDS LEFT TO DO WARPED WALL")
04    wait(1)
05    print("2 SECONDS LEFT TO DO WARPED WALL")
06    wait(1)
07    print("1 SECONDS LEFT TO DO WARPED WALL")
08    wait(1)
09    print("You've failed!")
10    wait (0)   
11    if (humanoid ~= nil) then
12    humanoid.Sit = true
13    end
14end
15 
16script.Parent.Touched:connect(OnTouched)   
0
From what I know and have tried. You cannot force the human to not jump even if you remove the control module. The only way I know is... Put a sea at the player so that he sits in it and then make the Jump Power to 0. Works every time. ???? bostaffmanbulgaria1 89 — 5y

2 answers

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago
01local ClimbTime = 3
02local StandTime = 5
03 
04local function StartedClimbing(Climbing)
05    local Humanoid = Climbing.Parent:FindFirstChildOfClass("Humanoid")
06    if (Humanoid) then wait(ClimbTime)
07        if (Humanoid:GetState() == Enum.HumanoidStateType.Climbing) then
08            Humanoid.PlatformStand = true
09            wait(StandTime)
10            Humanoid.PlatformStand = false
11        end
12    end
13end
14 
15script.Parent.Touched:Connect(StartedClimbing)   
0
This will give you the basis code you desire. I am unsure how to assist you with time. I however suggest diving into tick(). Ziffixture 6913 — 5y
0
I'm not sure is this true, but I think PlatformStand is deprecated. Block_manvn 395 — 5y
0
It's not. Ziffixture 6913 — 5y
0
Thanks a lot! I showed this to a friend of mine who wasn't on at the time and he used your script, edited it and got it working for me. Sorry I didn't make my request clear enough, but here's what he did. ItsJZaid 45 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
01--//Variables
02local player = game:GetService("Players").LocalPlayer;
03local userInputService = game:GetService("UserInputService");
04 
05local timeLimit, canJump = 3, true;
06local finished = false;
07 
08--//Events
09userInputService.JumpRequest:Connect(function()
10    if player.Character then
11        local humanoid = player.Character:FindFirstChild("Humanoid");
12        if humanoid then
13            humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, canJump); --Cancel jump if they can't jump, or let them jump
14        end;
15    end;
View all 52 lines...
0
This is unnecessarily complicated Ziffixture 6913 — 5y

Answer this question