I am trying to make a Part become completely transparent, over the course of 60 seconds. Wait 7 seconds, and then repeat continuously. Here's what I've Tried:
1) Insert NumberValue into Part (Value =0)
2) Inserted Script into part:
local transparency = script.Parent.Transparency while true do script.Parent.Transparency = transparency.Value for i = 1,transparency.Value do wait(1) transparency.Value = transparency.Value + 0.01666666 --i/60 script.Parent.Transparency = transparency.Value end wait (7) transparency.Value = 0 end
While testing the game, the part does not become more transparent.
Here's an error code that show up: Workspace.Part.Transparency Script:3: attempt to index local 'transparency' (a number value)
I'm new to scripting and would really appreciate some help/feedback. Thank you!
You're making it more complicated than it has to be. Just do this instead:
while true do for i = (1/60), 1, (1/60) do wait(1) script.Parent.Transparency = i end script.Parent.Transparency = 1 --This is to ensure that the transparency gets set equal to 1. wait(7) script.Parent.Transparency = 0 end --[[ i = (1/60) is that starting value, 1 is the ending value, and 1/60 is how much is added to the previous value. I basically set the transparency of the part equal to the variable i. That's all you had to do. ]]--
your scipt sets a variable AS the transparency it's only changing your variable.
local tparency = script.Parent tparency.Transparency = 1 --THIS WORKS local tparency2 = script.Parent.Transparency tparency2 = .5 -- This changes the variable
also why are you trying to change a nonexisting value you cant have a number in a number ;(transparency.Value does not work) instead do transparency = (number0