✓ Accepted answer
From the context given, I have assessed 3 distinct possible issues to this.
I'd first make sure the Boolean Value is not just placed within "StarterPlayer", rather within "StarterCharacterScripts." This would add the value inside the character.
Secondly, your code seems to be doing the right thing. However, rather than using a wait() loop, I'd switch to a .Changed event. This triggers when a certain property of the Boolean Value has been changed.
Here's my code:
wait(1)
local Player = script.Parent.Parent;
local Humanoid = Player:WaitForChild("Humanoid")
local Ragdoll = script.Parent
Ragdoll.Changed:connect(function(value)
if value == true then
Humanoid.Sit = true
else
Humanoid.Sit = false
end
end)
This gets rid of the irritating loop.
Now, something to address is how you are testing this function. Simply going in testing mode and changing the Boolean Value to true or false is not going to cut it. The game is Filtering Enabled, thus, any changes made to this property is local.
You can add this simple loop to the bottom of your script to test it out:
while wait(1) do
Ragdoll.Value = true
wait(1)
Ragdoll.Value = false
end
I hope this works out for you! LMK if any problems come up :)
`
2 comments
It's defining itself to the contents inside
.Value; it's not going to update when the value changes. The solution's to set the variable as it is,local Ragdoll = script.Parent, then when you go to check you doif Ragdoll.Value == Boolthen.Still not works