- What do you want to achieve? Keep it simple and clear!
I want to make a lazer come out of the player for an ability, I want the end of the lazer to be humanoidrootparts position, and have the lazer face the direction the humanoidrootpart is.
2. What is the issue? Include screenshots / videos if possible!
the issue is the lazer doesnt face the right direction, nor does the end get positioned at my center, but im mainly focusing on the direction
what happens:
what i want to happen:
![Untitled](/secure-uploads/uploads/original/5X/0/9/c/7/09c70380654f02e694d9ef706f6301d50d5a9f85.png)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
ive searched devhub, asked roblox assistant and chatgpt and ive found nothing. the best ive gotten is the lazer facing the opposite direction i want, if i was facing forward it would face left.
current code (stupid part is for welding since touched events dont work with two anchored parts and lazer has cancollide off)
if ability == 'Lazer' then
local lazer = rs.spawnables.AbilityVisuals.Lazer:Clone()
lazer.Player.Value = plr
lazer.Multiplier.Value = multi
lazer.Parent = workspace
local character = plr.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
lazer.CFrame = CFrame.new(humanoidRootPart.Position)
local direction = (character.Head.Position - humanoidRootPart.Position).unit
lazer.CFrame = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + direction)
local stupidpart = Instance.new('Part')
stupidpart.CanCollide = false
stupidpart.Parent = workspace
stupidpart.Transparency = 1
stupidpart.Anchored = true
stupidpart.Position = humanoidRootPart.Position
lazer.WeldConstraint.Part0 = lazer
lazer.WeldConstraint.Part1 = stupidpart
connection = lazer.Touched:Connect(function(part)
if part.Name == 'Crop' and part:FindFirstChild('Type') then
game.ReplicatedStorage.events.cropdestroyedserver:Fire(script.Parent.Player.Value, part, script.Parent.Multiplier.Value)
end
end)
game:GetService('Debris'):AddItem(lazer, 1)
game:GetService('Debris'):AddItem(stupidpart, 1)
end