Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The script I am using to click blocks is not working, any help??

Asked by 6 years ago

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.
0
USE A FOR LOOP !!!!!! User#24403 69 — 6y
0
lol Yosufgamer -7 — 6y
0
No clue how to do that. Yosufgamer -7 — 6y

1 answer

Log in to vote
0
Answered by
popeeyy 493 Moderation Voter
6 years ago

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)

0
The block won't appear? Yosufgamer -7 — 6y
0
There may be an error in the console/output, try looking there. popeeyy 493 — 6y
0
How do I fix this error? --"WoodP is not a valid member of Part" Yosufgamer -7 — 6y
0
It means it can't find WoodP in the Part. TheePBHST 154 — 6y
View all comments (3 more)
0
What do I do about it? Yosufgamer -7 — 6y
0
Make a part called WoodP, if it's there try making sure it's anchored and/or cancollide. popeeyy 493 — 6y
0
Thank you, that worked. Yosufgamer -7 — 6y
Ad

Answer this question