VFX not spawning with correct orientation

Hello, I’m trying to get a couple parts to spawn with the correct orientation.

I’m having some trouble getting these parts to be the same orientation as the player,
I have the y, z axis correct but for some reason I can’t get the x axis to work.


I am trying to get it to look like this

I have tried adding an additional x orientation but it still doesn’t seem to work, I’ve looked
everywhere but I can’t seem to find a fix for my particular issue

Here’s the code

local remote = game.ReplicatedStorage.RTap

local TS = game:GetService("TweenService")

remote.OnServerEvent:Connect(function(plr, Player)
	
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hum = char.Humanoid
	local humrp = char.HumanoidRootPart
	
	local PunchEffect = game.ServerStorage.Spiral:Clone()
	local ShockWave = game.ServerStorage.Wave:Clone()
	
	local Anim = Instance.new("Animation") 
	Anim.Parent = plr.Character 
	Anim.AnimationId = "rbxassetid://10069314419" 
	local TapAnim = plr.Character.Humanoid:LoadAnimation(Anim) 

	local Sound1 = Instance.new("Sound")
	Sound1.Parent = plr.Character
	Sound1.SoundId = "rbxassetid://10088035899"
	Sound1.Volume = 0.5
	Sound1.RollOffMaxDistance = 50
	
	
	local Info2 = {
		Transparency = 1,
		Size = Vector3.new(7,1,7)
	}

	local Info = {
		Transparency = 1,
		Orientation = Vector3.new(180,0,0),
		Size = Vector3.new(8,16,8)
	}
	
	
	local Tween1 = TS:Create(PunchEffect, TweenInfo.new(1),Info)
	local Tween2 = TS:Create(ShockWave, TweenInfo.new(1),Info2)

	--hum.AutoRotate = false--

	PunchEffect.Parent = game.Workspace
	ShockWave.Parent = game.Workspace

	PunchEffect.Position = humrp.Position + humrp.CFrame.LookVector * 10
	PunchEffect.Position = PunchEffect.Position + Vector3.new(0,-1.5,0)
	ShockWave.Position = humrp.Position + humrp.CFrame.LookVector * 10
	ShockWave.Position = ShockWave.Position + Vector3.new(0,1,0)
	
	PunchEffect.Orientation = humrp.Orientation + humrp.CFrame.LookVector
	ShockWave.Orientation = humrp.Orientation + humrp.CFrame.LookVector
	
	PunchEffect.Orientation = PunchEffect.Orientation + Vector3.new(-90,0,0)
	
	Tween1:Play()
	Tween2:Play()
		
end)

I’m relatively new to scripting so I am super sorry if this is a simple fix, any help is appreciated.

Scripting, especially CFrames and orientation related stuff can be difficult at first. A CFrame is a single datatype that represents both the position and orientation of an object.

You can get a CFrame at a position, looking at the target, and then rotate it onto it’s side with the code below:

local STUDS_INFRONT_OF_CHARACTER = 6
local lookVector = humrp.CFrame.LookVector
local pos = humrp.CFrame.p + (lookVector * STUDS_INFRONT_OF_CHARACTER)
local targetCFrame = CFrame.new(pos, pos+lookVector) * CFrame.Angles(math.pi*.5,0,0)
Shockwave.CFrame = targetCFrame
2 Likes

Hello, i really appreciate the help, it worked. sorry again, i am new to scripting

1 Like