Hey can someone help me with a road drawing system I’m making? Its supposed to draw the roads in the direction of the red line but for some reason the orientation doesn’t work.
local FlagPlacementPos = nil
game.ReplicatedStorage.Signals.UpdateFlagPlacement.OnServerEvent:Connect(function(plr, pos)
FlagPlacementPos = pos.p
end)
script.Parent.Activated:Connect(function()
local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local ray = Ray.new(FlagPlacementPos, Vector3.new(0, -20, 0))
local ignoreinstance = workspace.Water
local part, position = workspace:FindPartOnRay(ray, ignoreinstance, false, true)
--print("Activated")
if part ~= nil then
--print("Part not nil..part name is "..part.Name)
if part:FindFirstAncestor("World Map") then
--print("Part is ancestor of world map")
local flag = game.ReplicatedStorage.GameObject.CaptureFlag:Clone()
flag.Parent = workspace
flag.Name = plr.Name.." Flag"
flag.Flag.g.Frame.t.Text = plr.Name
flag:SetAttribute("FlagOwner", plr.Name)
flag.Pole.Color = plr.playerdata.PlayerColor.Value
flag.Flag.g.Frame.t.TextColor3 = plr.playerdata.PlayerColor.Value
flag.Flag.g.Frame.UIStroke.Color = plr.playerdata.PlayerColor.Value
flag:SetPrimaryPartCFrame(CFrame.new(position.X, position.Y + 2, position.Z))
script.Parent:Destroy()
flag.Radius.CanCollide = true
local parts = flag.Radius:GetTouchingParts()
game.ReplicatedStorage.Signals.RemoveFlag:FireClient(plr)
for _, p in pairs(parts) do
if p:FindFirstAncestor("World Map") then
if not p:GetAttribute("Ruler") or p:GetAttribute("Ruler") == nil then
p.Color = plr.playerdata.PlayerColor.Value
p:SetAttribute("Ruler", plr.Name)
end
end
end
flag.Radius:Destroy()
end
end
end)
Above is the script used. If anyone could help that would be greatly appreciated!