I am making it so you can't jump unless you click a block then it makes you jump

this script inserts the value to make sure if you can jump or not

local plr = game.Players.LocalPlayer
wait(1)
name = plr.Name
    repeat wait() until plr.Character
local chr = plr.Character
local Jump = Instance.new("BoolValue")
	Jump.Name = "jump"
	Jump.Parent = chr
	
chr:WaitForChild("Humanoid").Changed:connect(function()
	if Jump.Value == false then
    	chr.Humanoid.Jump = false
	end
end)

this is the script to stop you from jumping

local plr = game.Players.LocalPlayer
wait(1)
name = plr.Name
    repeat wait() until plr.Character
local chr = plr.Character
local Jump = Instance.new("BoolValue")
	Jump.Name = "jump"
	Jump.Parent = chr
	
chr:WaitForChild("Humanoid").Changed:connect(function()
	if Jump.Value == false then
    	chr.Humanoid.Jump = false
	end
end)

this is the script to make you jump

local Button = script.Parent
click = Button.ClickDetector

click.MouseClick:connect(function(player)
	local name = player.Name
	local character = game.Workspace:FindFirstChild(name)
	local humanoid = character.Humanoid
	wait()
	local value = character.jump
	value.Value = true
	humanoid.Jump = true
	value.Value = false
end)
	

but for the last one it says "13:23:58.304 - jump is not a valid member of Model" I even checked the player model and it had that value in it Everything else works because I edited the value in test mode and it let me jump

3 comments

0

try value = character:WaitForChild("jump") since the thing isn't automatically there

0

and instead of repeat wait() until plr.Character you could use the CharacterAdded event of a player.

0

use :Connect() it will help in the near future