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

How to make a brick that unanchors everything it touches?

Asked by 5 years ago

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
Touched event -> if not baseplate -> Anchored = false. Rheines 661 — 5y

2 answers

Log in to vote
0
Answered by
Miniller 562 Moderation Voter
5 years ago

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
With a bit of tweaking this works. Thanks! User#26313 0 — 5y
Ad
Log in to vote
0
Answered by
blockmask 374 Moderation Voter
5 years ago

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)
0
Ok thank you, I'll try this. User#26313 0 — 5y
0
blockmask, I didn't found any part of a player's character what was anchored.. Miniller 562 — 5y
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.. Miniller 562 — 5y
0
Who makes a game on a baseplate? blockmask 374 — 5y
View all comments (4 more)
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 Miniller 562 — 5y
2
just have the part in the air then, or use an ignore list theking48989987 2147 — 5y
0
It's funny how hard you're trying to get your answer accepted, I'll just let you have it blockmask 374 — 5y
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? Miniller 562 — 5y

Answer this question