So im trying to make a block like in shadow run, where if you click it the transparency will go to 1 after 1-2.5 seconds. Can someone pls help me? Im having no errors but the script just doesnt work.
The script:
CD = script.Parent P = CD.Parent P.Transparency = 0 function onMouseClick() P.Transparency = 0.9 local value = P.Transparency local number = 0.1 repeat value += number task.wait(0.5) until value == 0 end CD.MouseClick:Connect(onMouseClick())
local value = P.Transparency
You're setting a number variable of the property instead of changing it. Doing it like this would only save the transparency but can't be modified to actually change the part's transparency. Try doing it this way.
for i = 0, 1 do -- You can use the repeat method if you want, it probably works the same way as this one. P.Transparency += i task.wait(0.5) end
Or you can use TweenService.