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!

25 comments
can you explain where this script is located? Also, why do you define a touch event within a for loop?
The touched event does damage, but that's not what I'm focusing on here. The script is in ServerScriptService, and there's a remote event firing it, but I asked for a way to get a certain part of an orientation of something.
If the script is in ServerScriptService why is the server handling user input?
The local script sends something telling the server script what key was pressed, but the key pressing goes down in the local script, not the server script.
That's not the whole script, but you don't really need the whole script, because everything else is pretty much working just fine.
Why is the server checking the key pressed? Your game will suffer from input lag for doing that.
Well this script is for a sort of magic you could say. This magic has different moves, and I decided instead of doing a separate script for each move, I would just make one script that does all of the moves.
I'm not referring to that at all. I'm asking why are you having the server check which key the player pressed.
The local script checks what key the user presses, and if the user presses say r, it would play some animations for that move in the local script, then fire the server script. The server script would then check the key to know what move to do.
Your game suffers from input lag then, and you should be playing animations client side. They will replicate. The server should never, under any circumstance, handle user input, either directly or indirectly.
That wasn't the original question anyway.
Animations are playing client side. And the key is just being sent to the server script as a variable that is checked. The server script isn't actually doing anything to the key, it's just reading what the key was.
It's not at all "Handling" user input, it's just checking what the user input is . . .
What he's trying to tell you is that your entire script needs to be fixed. It's simply in the wrong location, we are helping you by letting you know that it would cause so many problems in the long run to keep this where it is. Also if you move it, you may even realize how easy it is to solve your problem.
How many times do I have to say this . . . the problem I'm having has nothing to do with the location of the script. You say, "Your entire script needs to be fixed", yet how am I supposed to fix anything with vague answers like that? All I wanted to know was how I could make something face the same direction as my player, and be spinning while doing so.
And why would I move a server script anywhere other than ServerScriptService, where server scripts are supposed to go. Incap never stated anything about the position of the script, he said I am having input lag issues, so where'd you get the idea my script location was the issue?
We can't help you with that if the script is in the wrong location though. Which player is it supposed to be aligned with? If you just keep it where it should go, then you can just align it to the player that the script is in, otherwise, it's going to be more complicated than it needs to be. As for you saying it's not handling user input, if it checks any user input, then it is handling user input
Okay, I still don't get why you think the script location is the issue. I already said the script is in ServerScriptService, and it's being fired by a remote event from a client script in the player. That isn't the whole script, as I also already stated, so of course it's not just going to work like a charm.
The script's not even in the player to begin with, that would work even less than it does now.
make a module script holding everything you don't want to keep making a script for and then have a player script handling all the input. This whole script being in server scripts is the problem. If this script was inside the player, then you'd be able to orient it to the player however you wanted.
Even if your game only has 1 player max, there will still be lag
I already can orient it to the player however I want, that's kind of what remote events do . . . and I still need to learn how to use module scripts, because I have absolutely no idea how those work, if you have a good tutorial you would recommend, please send it.
https://developer.roblox.com/api-reference/class/ModuleScript I don't have a tutorial because I went into this with prior knowledge, but I can explain it a bit. So you make a module script, and in it you make a bunch of functions (they can't be anonymous). In a separate script, at the top, you'd write "require(modulescript)" and then you can use the functions from the module script.
Mk.
alright, I think I realized what you were doing wrong, you just asked the wrong question. What I think you meant was you needed either the X or Z lookVector of the character's humanoidrootpart. I fixed that in my answer, so if that fixes your problem, then go ahead and mark it as the accepted solution.