Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)	

1 comment

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. ????

2 answers

✓ Accepted answer
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)    

4 comments

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().

0

I'm not sure is this true, but I think PlatformStand is deprecated.

0

It's not.

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.

--//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);

1 comment

0

This is unnecessarily complicated

This discussion is preserved as it was. New answers, comments, and votes are closed.