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

How can I perform multiple scripts, when I click a block?

Asked by 5 years ago

I am right now trying to make it so when I click a button, I have iron bars that will come up, but I do not know how to perform it, I have the script to make it so the iron bars move up.

local part = script.Parent

for i = 1,10 do part.Position = part.Position + Vector3.new(0,.5,0) wait(.3) end

But I do not know how to make it so when I click a button, it performs the action to all of the blocks I want it to. Anyone able to help me out with a script that may work?

0
I would suggest to use TweenService instead of a for loop for moving parts, and moving via vectors is susceptible to collision with other objects, so you should use CFrame instead. Nosteal 50 — 5y
0
I found the script above on a YouTube video, so I have basically no experience with scripting, so I would not know how to preform any of that. Can you give me a script or dumb it down so I can understand it? thetoxicwasted 0 — 5y
0
We dont just write scripts for people here, you have to at least attempt it yourself first, ill link you to a wiki that would help you: https://www.robloxdev.com/api-reference/event/ClickDetector/MouseClick aazkao 787 — 5y
0
Ok, so if I understand this right, the `Workspace.Part.ClickDetector.MouseClick:connect(function(playerWhoClicked) print("Part was clicked by: " .. playerWhoClicked.Name) end)` Fires something once it is clicked, but what I want to do is not just fire one thing, I want to fire multiple. How would I do that. thetoxicwasted 0 — 5y
View all comments (7 more)
0
then just add whatever you want to fire inside the function, if you want to move 2 iron bars after clicking it, write 1 line of code each for each iron bar in the function aazkao 787 — 5y
0
a function doest just do one thing, it can do multiple things at a time if you want it to aazkao 787 — 5y
0
How would I be able to specify what part I want to move? This is my script ATM. local part = script.Parent for i = 1,50 do part.Position = part.Position + Vector3.new(0,.1,0) wait(.1) end thetoxicwasted 0 — 5y
0
you already specified the part with your part = script.Parent aazkao 787 — 5y
0
I think you should read up on for loops and assigning variables on the roblox wiki first, it should help get you started aazkao 787 — 5y
0
Ok I'll read up, thanks thetoxicwasted 0 — 5y
0
Ok I'm trying to work this out, so I'm trying "workspace.button.ClickDetector.MouseClick:connect(function(playerWhoClicked) local part = script.Parent for i = 1,50 do workspace.bar1.Position = workspace.bar1.Position + Vector3.new(0,.1,0) wait(.1) end end)" And for some reason it is not working thetoxicwasted 0 — 5y

Answer this question