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.)
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!
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)