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

Tornado like tool (Need help with the math to make it circle around the user)?

Asked by 7 years ago
Edited 7 years ago

So as some of you may know, I've been trying to make a tornado-like tool for the last 4 days. I've progressed a lot but I've still probably got a lot to do for it to work perfectly, this is my script

mouse = game.Players.LocalPlayer:GetMouse()
player = game.Players.LocalPlayer


mouse.Button1Down:connect(function()
    for i,v in pairs(game.Workspace:GetChildren()) do
if v.ClassName == "Part" then   
    dist = (v.Position - player.Character.Torso.Position).magnitude
    if dist < 100 then
move = Instance.new("BodyVelocity", v)
move.Velocity = player.Character.Torso.CFrame.lookVector * 200
move.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
game:GetService("Debris"):AddItem(move, 1)
    end
end
end
end)

What this currently does is makes anything close to it shoot in the direction the characters torso is facing but it needs to make it circle around the torso, I know this would be a loop. Im useless when it comes to the math in roblox scripting though and i have no idea where to even begin.

I've even tried to get free model tornadoes and they all say stuff like math.atan and honestly, I've never heard of that in the entirety of my scripting career (Which is only like a year, maybe less).

1 answer

Log in to vote
-2
Answered by 7 years ago

local angle=0

while v do v.CFrame=v.CFrame*CFrame.Angles(0, math.rad(angle), 0) angle=angle+.1 wait() end

0
Its velocity, not CFrame Witchest 48 — 7y
0
It makes it circle around the torso Gomlsauresrex -12 — 7y
0
Yes but that isn't what i asked, i asked how to make something circle around the torso with bodyvelocity Witchest 48 — 7y
Ad

Answer this question