To be honest, I have no idea what I did wrong, or if I am missing something. In this script I want to click a block, and make another block have effects. Any help?
script.Parent.ClickDetector.MouseClick:Connect(function() game.Workspace.WoodlogWB.WoodP.Transparency = 0.9 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.8 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.7 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.6 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.5 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.4 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.3 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.2 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0.1 wait(0.1) game.Workspace.WoodlogWB.WoodP.Transparency = 0 wait(0.1) game.Workspace.WoodlogWB.WoodP.CanCollide = true end) --WoologWB, and WoodP are the parts in game. --WoodP is the block I want to appear after clicking WoodlogWB. --WoodLogWB has the the ClickDetector inside of it.
You should use a for loop in this case as it's more efficient. You can find an explanation for these here: https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops#For
This code should do the trick and you can let me know if you have any issues!
script.Parent.ClickDetector.MouseClick:Connect(function() for i = 0, 1, .1 do game.Workspace.WoodlogWB.WoodP.Transparency = 1 - i wait(0.1) end game.Workspace.WoodlogWB.WoodP.CanCollide = true end)