local Skill1 = game.ReplicatedStorage.Skill:Clone()
game.ReplicatedStorage.SkillEvent.OnServerEvent:Connect(function(x,plr,number)
if number == 1 then
warn("working")
Skill1.Parent = workspace
Skill1:MoveTo(plr.Character.HumanoidRootPart.CFrame.LookVector + Vector3.new(50,0,0))
end
end)
this script working but no matter where the player looks, its only clones in one position
local Skill1 = game.ReplicatedStorage.Skill:Clone()
game.ReplicatedStorage.SkillEvent.OnServerEvent:Connect(function(x,plr,number)
if number == 1 then
warn(“working”)
Skill1.Parent = workspace
local pos = plr.Character.HumanoidRootPart.CFrame * CFrame.new(50,0,0)
Skill1:MoveTo(pos.Position)
end
end)
local Skill1 = game.ReplicatedStorage.Skill:Clone()
game.ReplicatedStorage.SkillEvent.OnServerEvent:Connect(function(x,plr,number)
if number == 1 then
warn(“working”)
Skill1.Parent = workspace
local pos = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,–Here change offset like this: 50 or -50)
Skill1:MoveTo(pos.Position)
end
end)
Well, this would be because the lookvector is so small that it doesn’t affect the position. I don’t know what you are trying to achieve, but go ahead and try multiplying instead of adding, and then adding it to the rootpart position.
LookVector is a unit vector, what this means is that it is a directional vector which will not have a Magnitude greater than 1, and will always be originated at (0,0,0).
CFrame multiplication on the -Z axis alone does Vector math which should give you the result you want.
For instance:
local Skill1 = game.ReplicatedStorage.Skill:Clone()
game.ReplicatedStorage.SkillEvent.OnServerEvent:Connect(function(x,plr,number)
if number == 1 then
warn("working")
Skill1.Parent = workspace
Skill1:MoveTo((plr.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-50)).p)
end
end)
You can also use purely Vector math and do something like:
local Skill1 = game.ReplicatedStorage.Skill:Clone()
game.ReplicatedStorage.SkillEvent.OnServerEvent:Connect(function(x,plr,number)
if number == 1 then
warn("working")
Skill1.Parent = workspace
Skill1:MoveTo(plr.Character.HumanoidRootPart.CFrame.p + (plr.Character.HumanoidRootPart.CFrame.LookVector * 50))
end
end)