Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a brick that unanchors everything it touches?

Ok, in ROBLOX I'm trying to create a disaster game and I have a tornado. The tornado moves in random directions and I want it to unanchor any parts it comes in contact with. I have some models spread around (houses, stores, and other stuff) and I want it to unanchor the parts inside the models it comes in contact with.

I've tried numerous scripts online, but they are either outdated or simply don't work. So, how would I go about doing this?

(By the way for those wondering, this isn't a request to script the entire thing, I would just like to know the functions and code structure required since I'm a beginner to Lua.)

1 comment

1

Touched event -> if not baseplate -> Anchored = false.

2 answers

✓ Accepted answer

Example:

--In my case, 'Tornado' is a part at Workspace.
workspace.Tornado.Touched:Connect(function(part)
	if part.Name ~= "Baseplate" then -- If part is not baseplate (keep this!)
		part.Anchored = false
	end
end)

This should unanchor every part it touches expect if the touched part is the Baseplate.

Sorry if I used something that can be done easier.

Hope this helps!

1 comment

1

With a bit of tweaking this works. Thanks!

You'd have to make a Touched event for the tornado. When the tornado is touched, it checks what touched it, and if it's not a player then it sets the anchored property of the part to false

Tornado.Touched:Connect(function(Part)
	if not game.Players:GetPlayerFromCharacter(Part.Parent) then
		--Unanchor the part
	end
end)

8 comments

0

Ok thank you, I'll try this.

0

blockmask, I didn't found any part of a player's character what was anchored..

0

And also, an important thing: You didn't added what I did, testing if the part is the baseplate. Now, if he uses your script, and tornado touches Baseplate, it will fall down..

0

Who makes a game on a baseplate?

0

But an NPC is not in game.Players.. And there are many people making game on BP. But also, if that hits the ,,floor'' they are standing on, it will just be unanchored and fall down. Except terrain

2

just have the part in the air then, or use an ignore list

0

It's funny how hard you're trying to get your answer accepted, I'll just let you have it

0

I just love scripting, and also love help people. If he uses yours, AND the tornado touches the Floor, it will fall down, except if 'floor' is Terrain, but who makes a disater surviving game on terrain?

This discussion is preserved as it was. New answers, comments, and votes are closed.