I would need a brick to unanchor other bricks
function ontouch
part = anchor = true
I would need a brick to unanchor other bricks
function ontouch
part = anchor = true
First, end is missing. Second, function ontouch isn't defined and is missing (), so you have to define the function by using script.Parent.Touched:connect(ontouch). Also you can't use part = anchor = true, you need to change its Anchored property by using script.Parent.Anchored = false , assuming the script is inside of the part.
local brick1 = workspace:Part1 --a part you want to unanchor
local brick2 = workspace.Part2 --another part you want to unanchor
local thisBrick = script.Parent
function ontouch()
brick1.Anchored = false
brick2.Anchored = false
end
thisBrick.Touched:Connect(ontouch)
I recommend browsing through the Roblox Wiki to learn more about Lua since it seems you do not know how to use functions and properties correctly. If this worked, please upvote and accept my answer, if not comment because I wrote this on Notepad and didn't test it. I also apologize in advance if this is a poorly written answer, it's almost 12 AM and I am really tired. Thanks!
brick.Anchored = false
or...
local brick -- you define it
brick.Touched:connect(t)
if t.name = "Humanoid" then
local otherBricks = {} -- u define it
for _, v in pairs(otherBricks) do
if workspace:FindFirstChild(v) then
local part = workspace:FindFirstChild(v.Name)
part.Anchored = false
end
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
I'd recommend using WaitForChild() on those parts and 'C'onnect.
Whats the difference between connect and Connect?