Part unanchors when it touches another part

Hello, devforums!
So, I’m making a game where a ball is trying to kill you, and you have to kill it before it does so.
But I’m stuck on making it destroy buildings. (when it runs into a part, that part unanchors)
All replies are appriciated.
(Tell me if you need more details.)

Put it into ball

local ball = script.Parent
ball.Touched:Connect(function(part)
if part:IsA("Part") then
part.Anchored = false
end
end)

1 Like

How do i close ‘then’?
charrrrrrrr

Oh wait there was error i will fix it wait a sec. I fixed it try again

I’ll notify you if it works when i get on my pc. Thanks!

No problem, but it will unanchore every part like platform to so i thing you can do like folder which parts you want unanchors and then i can help if you want i can make another script with this folder and it will unachore only basic parts i can make better if you want.

Yeah i made it
Here is how to do it:
Make folder in workspace named UnanchorePartFolder into this folder put parts you want to unanchore(you can put here anything models and folders too, it will work with anything you put in it) and insert this script to ball instead of old one:

--Services--
local WorkspaceService = game:GetService("Workspace")

--Parts--
local ball = script.Parent

--Folders--
local UnanchorePartFolder = WorkspaceService.UnanchorePartFolder

ball.Touched:Connect(function(part)
	for i,v in pairs(UnanchorePartFolder:GetDescendants()) do
		if v == part then
			part.Anchored = false
	end
	end
end)
1 Like

It works, Thanks!

charrrracterrrrrrr limittttttttt

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.