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

Script not detecting if a BoolValue is changed?

Asked by 4 years ago
Edited 4 years ago

I'm trying to make a theme park ride with a motor for the thing that holds you in the ride. So I added weldconstraints, the script enables the weldconstraints so that it holds the motor because it would glitch out when the ride is in motion. I have tested this without the script works perfect. But for some reason the script wont detect the boolvalue when it is changed.

Btw the scripts inside a model

Here's the script:

Hold = script.Parent.Parent.Parent.Parent.Hold

Hold.Changed:Connect(function()
    print("ugh") --This word wont print
    if Hold.Value == true then
        script.Parent.Enabled = true
    end
    if Hold.Value == false then
        script.Parent.Enabled = false
    end
end)
0
do you get any error? bluzorro 417 — 4y
0
Are you changing the bool value in a Server Script or a Local Script ? iDarkGames 483 — 4y
0
Its a script inside a model in workspace, no errors dizzyjamison08 30 — 4y
0
I'm having the same thing, I was making a remote event test game before and I made a TextLabel that would say true when the BoolValue is true, and would say false when the BoolValue is false. I was trying to get a Touched and TouchEnded thingy, you know. TrustedInstaIler 17 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You need to use script.Parent.Enabled.Value, which changed the value of the boolean, else it does not change the value, just the boolean value itself so use:

Hold = script.Parent.Parent.Parent.Parent.Hold

Hold.Changed:Connect(function()
    print("ugh") 
    if Hold.Value == true then
        script.Parent.Enabled.Value = true --Need to access .Value to change the value of any variable
    end
    if Hold.Value == false then
        script.Parent.Enabled.Value = false
    end
end)
Ad

Answer this question