How could I properly position my path, I already positioned it under the player but now I need to position it 1 or 2 studs in front of were the player is looking
local PlacePath = script.Parent:WaitForChild("PlacePath")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PathPart = ReplicatedStorage:WaitForChild("IcePathPart")
PlacePath.OnServerEvent:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
local HRP = Character:FindFirstChild("HumanoidRootPart")
local Humanoid = Character:FindFirstChild("Humanoid")
if HRP and Humanoid then
local Cloned_PathPart = PathPart:Clone()
Cloned_PathPart.Parent = game.Workspace.PathParts
Cloned_PathPart.CFrame = CFrame.new(HRP.Position - Vector3.new(0,3,0))
end
end)
Just get the HumanoidRootPart’s LookVector property and multiply that by a small amount
local PlacePath = script.Parent:WaitForChild("PlacePath")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PathPart = ReplicatedStorage:WaitForChild("IcePathPart")
PlacePath.OnServerEvent:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
local HRP = Character:FindFirstChild("HumanoidRootPart")
local Humanoid = Character:FindFirstChild("Humanoid")
if HRP and Humanoid then
local Cloned_PathPart = PathPart:Clone()
Cloned_PathPart.Parent = game.Workspace.PathParts
Cloned_PathPart.CFrame = CFrame.new((HRP.CFrame.LookVector * 5) - Vector3.new(0,3,0))
end
end)
Ok quick question, why are there () around the HRP.CFrame.LookVector * 5
Prioritization basically (Or Order of Operations)
If I have this:
local Math = 5 + 2 * 5
print(Math)
The formula would first go: PEMDAS (Or (), Exponents, Multiplication, Division, Addition, then Subtraction)
So it’d be 2 * 5 = 10 + 5 = 15
Also when I tested the part doenst appear
Probably because I forgot to do a Position, LookAt thingy
local PlacePath = script.Parent:WaitForChild("PlacePath")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PathPart = ReplicatedStorage:WaitForChild("IcePathPart")
PlacePath.OnServerEvent:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
local HRP = Character:FindFirstChild("HumanoidRootPart")
local Humanoid = Character:FindFirstChild("Humanoid")
if HRP and Humanoid then
local Cloned_PathPart = PathPart:Clone()
Cloned_PathPart.Parent = game.Workspace.PathParts
local CurrentLook = HRP.CFrame.LookVector * 5
Cloned_PathPart.CFrame = CFrame.new((HRP.Position + CurrentLook) - Vector3.new(0,3,0))
end
end)
Also, If I zoom in and spin there should be circles forming cause of the path that doesnt happen. If you dont know what I mean its like the rotation
Not sure what you mean, the orientation should automatically be relative to where the Character is currently facing?
If you zoom in, and spin your character there should a tower that is made from the parts because the parts turn as the player turns, but that doesnt happen