Spawns to right rather then left

local rs = game.ReplicatedStorage
local fireBlast = rs.fireBlast
local blastPart = rs.BlastPart

local function blastFire(player)
	local char = player.Character or player.CharacterAdded:wait()
	local rootPart = char.HumanoidRootPart
	print("Player has pressed the key")
	local clone = blastPart:Clone()
	wait(0.5)
	clone.Parent = game.Workspace
	clone.Orientation = rootPart.CFrame.LookVector.Unit*1 + rootPart.Orientation
	clone.Position = rootPart.CFrame.LookVector.Unit*1 + rootPart.Position
	clone.Anchored = true
end

fireBlast.OnServerEvent:Connect(blastFire)

this script spawns mesh always to the right side of the player but i need it to spawn to the front. What tis be wrong with this or how do i make it spawn infront rather then to the right??

2 Likes

try this:

local displacement = 2
clone.CFrame = CFrame.new(rootPart.Position + rootPart.CFrame.LookVector * displacement)

displacement describes the number of studs the ball will be spawned infront of the player

if you want the ball to spawn to the left:

clone.CFrame = CFrame.new(rootPart.Position - rootPart.CFrame.RightVector* displacement)
1 Like

The mesh is still spawning to the right of the player

2 Likes

its gonna be a crappy video because my pc is low end pc

2 Likes

Can you maybe include a video + Your current code snippet?
Quality does not really matter - I just need to see it right now (can’t imagine the cframes not working)

local rs = game.ReplicatedStorage
local fireBlast = rs.fireBlast
local blastPart = rs.BlastPart

local function blastFire(player)
	local char = player.Character or player.CharacterAdded:wait()
	local rootPart = char.HumanoidRootPart
	print("Player has pressed the key")
	local clone = blastPart:Clone()
	wait(0.5)
	clone.Parent = game.Workspace
	local displacement = 2
	clone.CFrame = CFrame.new(rootPart.Position + rootPart.CFrame.LookVector * displacement)
	clone.Orientation = rootPart.CFrame.LookVector.Unit*1 + rootPart.Orientation
	clone.Anchored = true
end

fireBlast.OnServerEvent:Connect(blastFire)

its a script in serverscriptservice

1 Like

Okay that is quite the complex model! Can you maybe try it with a normal part so we can see what’s going on and what isnt working?

Also: maybe try removing the orientation for now?

so i removed the mesh and replace it with a part and it works exactily how i want to(spawns in front of player even if the player rotates) and i have tryed without the orientation

1 Like

wait i change script give me a second

1 Like

so this script works how i want it to

local rs = game.ReplicatedStorage
local fireBlast = rs.fireBlast
local blastPart = rs.BlastPart

local function blastFire(player)
	local char = player.Character or player.CharacterAdded:wait()
	local rootPart = char.HumanoidRootPart
	print("Player has pressed the key")
	local clone = blastPart:Clone()
	wait(0.5)
	clone.Parent = game.Workspace
	clone.Orientation = rootPart.CFrame.LookVector.Unit*1 + rootPart.Orientation
	clone.Position = rootPart.CFrame.LookVector.Unit*1 + rootPart.Position
	clone.Anchored = true
end

fireBlast.OnServerEvent:Connect(blastFire)

but this one just spawns the part and doesnt change the rotation

local rs = game.ReplicatedStorage
local fireBlast = rs.fireBlast
local blastPart = rs.BlastPart

local function blastFire(player)
	local char = player.Character or player.CharacterAdded:wait()
	local rootPart = char.HumanoidRootPart
	print("Player has pressed the key")
	local clone = blastPart:Clone()
	wait(0.5)
	clone.Parent = game.Workspace
	
	local displacement = 2
clone.CFrame = CFrame.new(rootPart.Position + rootPart.CFrame.LookVector * displacement)
	clone.Anchored = true
end

fireBlast.OnServerEvent:Connect(blastFire)

1 Like

So was I correct? Please let me know! Is everything working?

the first script works with the part

1 Like

so its the mesh that i have :skull_and_crossbones: :skull: :skull:

1 Like

I’m sorry I’ll head to bed now, I wish you the bestest of luck and maybe try using :SetPivot() or sumething.
Have a great night/day/whatever idc -sorry im feeling funny today

thanks for tryin to help me i kinda just threw abunch of words and scripts at you sorry bye

Try

clone.CFrame = CFrame.new(rootPart.Position - rootPart.CFrame.LookVector * displacement)

Why set the CFrame and the orientation? I’m not exactly sure what you’re trying to do, but you certainly never want to be adding together orientations.

Did they solve your problem?
If so, you should mark their post where they solved your problem.

I think I solved it - No clue tho