Hey! I’ve been wondering, how could I enable only some player controls? For example allow jumping, but prevent players from walking.
Because :DisableControls() disables even jumping.
Hey! I’ve been wondering, how could I enable only some player controls? For example allow jumping, but prevent players from walking.
Because :DisableControls() disables even jumping.
play around with players humanoid maybe, like set the walkspeed to 0 etc?
I’m assuming you want to disable all controls expect jumping so here is some quick code that I wrote
local LocalPlayer = game.Players.LocalPlayer
local LocalPlayer_Name = game.Players.LocalPlayer.Name
local UIS = game:GetService("UserInputService")
wait(1)
local Local_Character = game.Workspace:FindFirstChild(LocalPlayer_Name):WaitForChild("HumanoidRootPart")
UIS.InputBegan:Connect(function(Input)
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
Controls:Disable()
if Input.KeyCode == Enum.KeyCode.Space then
game.Players.LocalPlayer.Character.Humanoid.Jump = true
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.