Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to make a brick that unanchors everything it touches?

Asked by 6 months 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 600 — 6mo

2 answers

Log in to vote
0
Answered by
Miniller 364 Moderation Voter
6 months 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! iPixelDev 3 — 6mo
Ad
Log in to vote
0
Answered by
blockmask 351 Moderation Voter
6 months 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. iPixelDev 3 — 6mo
0
blockmask, I didn't found any part of a player's character what was anchored.. Miniller 364 — 6mo
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 364 — 6mo
0
Who makes a game on a baseplate? blockmask 351 — 6mo
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 364 — 6mo
2
just have the part in the air then, or use an ignore list theking48989987 2009 — 6mo
0
It's funny how hard you're trying to get your answer accepted, I'll just let you have it blockmask 351 — 6mo
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 364 — 6mo

Answer this question