-
What do you want to achieve?
Trying to make a tool that spawns a laser beam in front of the character torso -
What is the issue?
The laser beam spawns in a different orientation. -
What solutions have you tried so far?
I have tried looking posts related to this post but I couldnt understand most of them. I know I can use lookVector but I just dont know how.
Scripts:
Local scripts:
wait()
local plr = game.Players.LocalPlayer
local char = plr.Character or plr:WaitForChild("Character") or nil
local Events = script.Parent.Events
local Fire = Events.RemoteEvent
local CoolDown = 1
db = false
script.Parent.Activated:Connect(function()
print("hm")
local char = plr.Character or plr:WaitForChild("Character")
if not db then
db = true
local x = char.Torso.Position.X
local y = char.Torso.Position.Y
local z = char.Torso.Position.Z
local r1 = char.Torso.Orientation.X
local r2 = char.Torso.Orientation.Y
local r3 = char.Torso.Orientation.Z
local torso = char.Torso
Fire:FireServer(x,y,z,r1,r2,r3,torso)
wait(CoolDown)
db = false
end
end)
Server Script:
wait()
local Events = script.Parent.Events
local Fire = Events.RemoteEvent
Fire.OnServerEvent:Connect(function(plr,X,Y,Z,R1,R2,R3,TORSO)
if plr then
print("e")
local klone = game.ReplicatedStorage.LaserBeam:Clone()
klone.Parent = workspace
klone.Position = Vector3.new(X + 26 ,Y,Z)
klone.Anchored = true
klone.CanCollide = false
print(TORSO.CFrame)
klone.Orientation = Vector3.new(R1,R2,R3)
--[[
klone.CFrame = CFrame.new(TORSO.CFrame.Position, TORSO.CFrame.Position + TORSO.CFrame.lookVector)
--]]
end
end)
Any help will be appreciated