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

Block Seat for a specific amount of seconds?

I want to make people sit on a chair for 4 or 5 seconds. I think it doesn't work and it seems like it doesn't work! Can someone tell me more, where to place it or like that. I put the localscript in the seat. Here is what I got:

if hit.Parent then
local jumpDisabled = true

ContextActionService:BindActionAtPriority("JumpOverride", function()
	if jumpDisabled then
		return Enum.ContextActionResult.Sink
	else
		return Enum.ContextActionResult.Pass
	end
	end, false, Enum.ContextActionPriority.High, Enum.PlayerActions.CharacterJump, Enum.KeyCode.Space)
	
	wait (4)
	
	local jumpDisabled = false

	ContextActionService:BindActionAtPriority("JumpOverride", function()
		if jumpDisabled then
			return Enum.ContextActionResult.Sink
		else
			return Enum.ContextActionResult.Pass
		end
	end, false, Enum.ContextActionPriority.High, Enum.PlayerActions.CharacterJump, Enum.KeyCode.Space)

1 answer

You can do that by simple disabling the Players JumpPower. Use the Seat Occupant to get the Humanoid.

script.Parent.Seat.Changed:Connect(function() --This fires the script whenever something on the seat changed

local Humanoid = script.Parent.Occupant 

if Humanoid then --Makes sure to only fire when there is a Humanoid

Humanoid.JumpPower = 0 --Sets the JumpPower to 0 so they can't leave the seat.

wait(4) --How long you want the player to stay in the seat

Humanoid.JumpPower = 16 --Allows the player to leave the seat
Humanoid.Jump = true --This will force the player to jump

I didn't test the script in studio but it should work.

1 comment

0

Thank you, but where to place that script and is that a localscript or a script.

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