Script not detecting boolvalues

  1. What do you want to achieve?
    I want my character to only sprint when a value in the character is true. so if the value is
    false the character wont sprint.

  2. What is the issue?
    The problem is that my sprint script cant detect if the boolvalue is true or false

  3. What solutions have you tried so far?
    I have tried changing the boolvalue’s name and parent and looking for similar problems
    in the dev forum

here is the part of my sprint script that doesnt work

Input.InputBegan:Connect(function(input,pro)
	if (input.KeyCode == Sprint) and (not pro) and (not Crouching) and CanSprintzyeah == true then -- cant detect
		Sprinting = true
		jitzsprintin.Value = true
		SetSpeed(false,SprintSpeed,SprintJump)
	elseif (input.KeyCode == Crouch) and (not pro) and (not Sprinting) and CanCrouchzyeah == true then -- cant detect
		jitzcrouchin = true
		Crouching = true
		hum.HipHeight = -1.3
		SetSpeed(false,CrouchSpeed,CrouchJump)
	end
end)
Input.InputEnded:Connect(function(input,pro)
	if (input.KeyCode == Sprint) and (not Crouching) and CanSprintzyeah == true then -- cant detect
		Sprinting = false
		jitzsprintin.Value = false
		SetSpeed(true)
	elseif (input.KeyCode == Crouch) and (not Sprinting) and CanCrouchzyeah == true  then -- cant detect
		jitzcrouchin = false
		Crouching = false
		hum.HipHeight = 0
		SetSpeed(true)
	end
end)

Try printing out all of this:

You may find your error there.

1 Like

I think i found the solution ill let you know if it worked

1 Like

I have found the solution already i didnt put .Value

1 Like

Make sure you only access Bool Value with either LocalScript or Script.
If you set your BoolValue in LocalScript, you can access it only with LocalScript only. Same thing with Script

1 Like

i have found the solution already it was because i didnt put .Value, thanks for replying tho