So, I've been working at this for hours now, and I can't find anything in the forums. I want to make a spinning tornado mesh, and I need to make it face the same direction as the player, but I can't find a good way to do so. I had to use CFrame's in order to keep everything in place properly, and I'm really confused with it.
Script:
elseif key == Enum.KeyCode.T then local tpc1 = tornadoPunch:Clone() local tpc2 = tornadoPunch:Clone() local tpc3 = tornadoPunch:Clone() tpc1.Parent = game.Workspace tpc2.Parent = game.Workspace tpc3.Parent = game.Workspace tpc1.Orientation = rootPart.Orientation + Vector3.new(0,-90,0) tpc2.Orientation = rootPart.Orientation + Vector3.new(0,-90,0) tpc3.Orientation = rootPart.Orientation + Vector3.new(0,-90,0) tpc1.Position = rootPart.CFrame.p + rootPart.CFrame.lookVector*150 tpc2.Position = rootPart.CFrame.p + rootPart.CFrame.lookVector*150 tpc3.Position = rootPart.CFrame.p + rootPart.CFrame.lookVector*150 setY(tpc1,rootPart) setY(tpc2,rootPart) setY(tpc3,rootPart) local db = false for i = 1,50,1 do tpc1.CFrame = CFrame.new(tpc1.CFrame.X,tpc1.CFrame.Y,tpc1.CFrame.Z) * CFrame.Angles(math.rad(i*8),0,0) -- This makes it spin, but I need the middle number to be whatever the middle number is for the character's HumanoidRootPart. How would I go about getting this number? tpc2.CFrame = CFrame.new(tpc2.CFrame.X,tpc2.CFrame.Y,tpc2.CFrame.Z) * CFrame.Angles(math.rad(i*12),0,0) tpc3.CFrame = CFrame.new(tpc3.CFrame.X,tpc3.CFrame.Y,tpc3.CFrame.Z) * CFrame.Angles(math.rad(i*16),0,0) tpc1.Size = tpc1.Size + Vector3.new(i/6,i/6,i/6) tpc1.Transparency = i/100 + 0.5 tpc2.Size = tpc2.Size + Vector3.new(i/4,i/4,i/4) tpc2.Transparency = i/90 + 0.5 tpc3.Size = tpc3.Size + Vector3.new(i/2,i/2,i/2) tpc3.Transparency = i/80 + 0.5 wait(0.01) tpc2.Touched:Connect(function(hit) local humanoid = hit.Parent.Humanoid if humanoid ~= nil and hit.Parent.Name ~= player.Name and db == false then humanoid:TakeDamage((powerLevel.Value*0.1)*math.random(5,15)) db = true wait(5) db = false end end) end tpc1:Destroy() tpc2:Destroy() tpc3:Destroy() elseif key == Enum.KeyCode.V then
Any help would be GREATLY appreciated, thanks!
Just focusing on this little section of your code here, assuming that you have moved it to starter scripts, where it should have been in the first place.
for i = 1,50 do -- you don't need to put increment by 1 because the default is 1 tpc1.CFrame = CFrame.new(tpc1.CFrame.X,tpc1.CFrame.Y,tpc1.CFrame.Z) * CFrame.Angles(math.rad(i*8),0,script.Parent.HumanoidRootPart.CFrame.LookVector.Z) --this is where it was changed tpc2.CFrame = CFrame.new(tpc2.CFrame.X,tpc2.CFrame.Y,tpc2.CFrame.Z) * CFrame.Angles(math.rad(i*12),0,script.Parent.HumanoidRootPart.CFrame.LookVector.Z) tpc3.CFrame = CFrame.new(tpc3.CFrame.X,tpc3.CFrame.Y,tpc3.CFrame.Z) * CFrame.Angles(math.rad(i*16),0,script.Parent.HumanoidRootPart.CFrame.LookVector.Z) tpc1.Size = tpc1.Size + Vector3.new(i/6,i/6,i/6) tpc1.Transparency = i/100 + 0.5 tpc2.Size = tpc2.Size + Vector3.new(i/4,i/4,i/4) tpc2.Transparency = i/90 + 0.5 tpc3.Size = tpc3.Size + Vector3.new(i/2,i/2,i/2) tpc3.Transparency = i/80 + 0.5 wait(0.01) tpc2.Touched:Connect(function(hit) local humanoid = hit.Parent.Humanoid if humanoid ~= nil and hit.Parent.Name ~= player.Name and db == false then humanoid:TakeDamage((powerLevel.Value*0.1)*math.random(5,15)) db = true wait(5) db = false end end) end
you could make a variable to handle the size of that line, but I put it all right there so it would be easier to understand what I did.
I have it set to X right now, but Z might also be what you were looking for. The Y look vector would always be 0 because that's the one aiming up into the sky, so it would stay the same unless your player was knocked down.