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??
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)
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
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)
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
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.