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

Change the property of cancollide with a button?

Asked by 10 years ago

I would like to connect one button to 8 bricks, I need these bricks to be cancollide when the button is enabled and uncancollide when the button is unenabled. I was wondering if this was an easy script? If not could someone make it and PM me at, Ffbryce1 on my account to get it to me?

3 answers

Log in to vote
0
Answered by 10 years ago

Their is a way, to make a button and collide. It's like a door and admin script when you put the player name, like this : "Door1", "Door2" , "Door3" You can try on your own, if you can.

Ad
Log in to vote
0
Answered by 10 years ago

See I dont know how to script but I know it would be like if Button disabled = ("door1","door2") collide

and opposite with other? Could someone type up the script and slap it in the comments if its that easy?

Log in to vote
0
Answered by
u_g 90
10 years ago
  1. Name your 8 blocks "Part1", "Part2", "Part3", "Part4", "Part5", "Part6", "Part7", and "Part8" (not your button)
  2. Group all of the blocks together, and insert this script in your button(not in any of the parts, but actually in the model).

Script:

local opening = false
local function onTouched(hit)
if opening == true then return end -- don't do anything if it is already opening
if opening == false then 
opening = true
print("Brick was touched") -- optional
script.Parent.Parent.Part1.Transparency = 1 -- make it transparent, but it's optional
script.Parent.Parent.Part1.CanCollide = false
script.Parent.Parent.Part2.Transparency = 1
script.Parent.Parent.Part2.CanCollide = false
script.Parent.Parent.Part3.Transparency = 1
script.Parent.Parent.Part3.CanCollide = false
script.Parent.Parent.Part4.Transparency = 1
script.Parent.Parent.Part4.CanCollide = false
script.Parent.Parent.Part5.Transparency = 1
script.Parent.Parent.Part5.CanCollide = false
script.Parent.Parent.Part6.Transparency = 1
script.Parent.Parent.Part6.CanCollide = false
script.Parent.Parent.Part7.Transparency = 1
script.Parent.Parent.Part7.CanCollide = false
script.Parent.Parent.Part8.Transparency = 1
script.Parent.Pareet.Part8.CanCollide = false
wait(5) -- change this to any amount of time that you want the bricks to be open
script.Parent.Parent.Part1.Transparency = 0 -- make it visible
script.Parent.Parent.Part1.CanCollide = true
script.Parent.Parent.Part2.Transparency = 0
script.Parent.Parent.Part2.CanCollide = true
script.Parent.Parent.Part3.Transparency = 0
script.Parent.Parent.Part3.CanCollide = true
script.Parent.Parent.Part4.Transparency = 0
script.Parent.Parent.Part4.CanCollide = true
script.Parent.Parent.Part5.Transparency = 0
script.Parent.Parent.Part5.CanCollide = true
script.Parent.Parent.Part6.Transparency = 0
script.Parent.Parent.Part6.CanCollide = true
script.Parent.Parent.Part7.Transparency = 0
script.Parent.Parent.Part7.CanCollide = true
script.Parent.Parent.Part8.Transparency = 0
script.Parent.Pareet.Part8.CanCollide = true
wait(2) -- make it unopenable for two seconds more
opening = false
end
end -- might be needed? Might not. If it's not needed, delete this line.
script.Parent.Touched:connect(onTouched) -- make sure that the script connects to the function called "onTouched" when it is activated.

Hope I helped. This took a while to write out. Tell me if there's an error.

0
Yeah, thank you for taking the time. I need to know how to put it on a click button not touch. And they will not reappear. I would like them to be instant on and instant off. I want them to be on forever until I turn the button off. Like a light switch. Ffbryce1 0 — 10y

Answer this question