Hello, How do I fix my script? I made a script where if you press "r" it would add increase a value by one (it is an intvalue by the way) so in the script it would do if the value were 1 then a part will become transparent but it doesn't exactly seem to work
local camera = game.Workspace.VehicleSeat local value = camera.Value.Value if value == 1 then do game.Workspace.p1.Transparency = 1 wait(1) end end
Your script will only check the Value once, which means that it's not going to detect when the Value is 1 unless it's 1 when the script starts. Try using the Changed event to check the Value whenever it changes.
local camera = game.Workspace:WaitForChild("VehicleSeat") local value = camera:WaitForChild("Value") local p1 = Workspace:WaitForChild("p1") -- if this doesn't print to the output, then all the variables listed above weren't there. print("Found all needed parts") value.Changed:connect(function() -- if this doesn't print then the value isn't changing. print("Value changed to "..value.Value) if value.Value == 1 then -- Remove do, you don't need that. p1.Transparency = 1 wait(1) end end)