So, I have this script here:
print("") ------------------------------------------{ LOCALS }------------------------------------------------------------------------------------------- local Generator1 = game.Workspace.Generator1.Switch.Button.Enabled1 -- don't mind this. local Generator2 = game.Workspace.Generator2.Switch.Button.Enabled2 -- this either. local test = game.Workspace.Part.Value --------------------------- --{ important local open = script.Parent.Open --------------------------- ------------------------------------------{ SCRIPT }------------------------------------------------------------------------------------------- if test.Value == true then script.Parent.CanCollide = false script.Parent.Transparency = 1 end
and it would all be fine, if it wasn't for the script not working. What I want it to do is find if a generator's boolvalue happens to be enabled (when the generator has been turned on) and trigger the "open the gate" event, which for testing was just simply wrote as CanCollide = false and Transparency = 1. After realizing the script isn't working I checked the output and it was empty. I decided to put up a random part with a wait(5) and enable the test value to see if it's a generator problem or a script problem, and it seems to be on the gate's script behalf.
all scripts are serverscripts and are all located within Workspace (edit: by workspace I mean they're all in their models that are located within workspace, you can see it clearly in the script's locals above. I've tried making the boolvalue a numbervalue and triggering the script to work by finding if the numbervalue's value is 1, but it didn't work either. I have no honest clue what is the cause of this and it's annoying, considering a huge part of my project is almost done if it wasn't for this damn gate.
If you want the gate to open whenever the value is set to true, here's what you'd do.
print("") ------------------------------------------{ LOCALS }------------------------------------------------------------------------------------------- local Generator1 = game.Workspace.Generator1.Switch.Button.Enabled1 -- don't mind this. local Generator2 = game.Workspace.Generator2.Switch.Button.Enabled2 -- this either. local test = game.Workspace.Part.Value --------------------------- --{ important local open = script.Parent.Open --------------------------- ------------------------------------------{ SCRIPT }------------------------------------------------------------------------------------------- test.Changed:Connect(function(new) script.Parent.CanCollide = not new -- If true, "not" true will be false, and vise versa. script.Parent.Transparency = (new and 1) or 0 -- If true, Transparency is 1, otherwise 0. end)
You are trying to get test.Value 's value!
this should work:
print("") ------------------------------------------{ LOCALS }------------------------------------------------------------------------------------------- local Generator1 = game.Workspace.Generator1.Switch.Button.Enabled1 -- don't mind this. local Generator2 = game.Workspace.Generator2.Switch.Button.Enabled2 -- this either. local test = game.Workspace.Part.Value --------------------------- --{ important local open = script.Parent.Open --------------------------- ------------------------------------------{ SCRIPT }------------------------------------------------------------------------------------------- if test == true then script.Parent.CanCollide = false script.Parent.Transparency = 1 end