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

How to make a humanoid action pervented for 3 seconds?

Asked by 9 years ago
local Player = game:GetService('Players').LocalPlayer 
repeat wait() until Player.Character 
local Character = Player.Character 
local Humanoid = Character:WaitForChild("Humanoid")  
Humanoid.Changed:connect(function() 
Humanoid.Jump = false 
end) 

So I know how to make jumping for a humanoid false, but how do you make it where they can jump every 3 seconds? Thanks a bunch!

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

You have three options. The first is to simply set the WalkSpeed to 0.

humanoid.WalkSpeed = 0

The disadvantage to this is that the player will still be able to jump and turn in first person or mouselock.

The second option is to anchor the torso. However, if the player is jumping or falling when this happens, it will make the character float.

character.Torso.Anchored = true

The third way can only be used in LocalScripts, but it is probably the most effective (depending on what your purposes are). You use the ControllerService to remove a player's control over their character.

local controllerService = game:GetService("ControllerService")
local controller = controllerService:GetChildren()[1]
controller.Parent = nil
--You can restore control by setting it's parent back to ControllerService.
0
so where you put it next to jump = false? GreekGodOfMLG 244 — 9y
0
These are just methods used to disable control of your character, as stated in the original question. It will not help you create a three second jump script. Perci1 4988 — 9y
Ad

Answer this question