so i have a bit of trouble and its with getting my wall to flip the right way heres the code
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ToolEquiped = false
local Tool = script.Parent
Tool.Equipped:Connect(function()
ToolEquiped = true
Main()
end)
function Main()
while ToolEquiped == true do
wait(0.1)
local WallPos
local MouseTarget = mouse.Target
local target
if MouseTarget then
target = MouseTarget.name
end
if target == "foundation" then
local ClosestDistance = math.huge
local ClosestAttachment
for _,attachment in pairs(mouse.Target:GetChildren()) do
if attachment.Name == "floorAttachments" then
local mousePos = mouse.Hit.p
local worldPos = attachment.WorldPosition
local distance = (mousePos - worldPos).Magnitude
if distance < ClosestDistance then
ClosestDistance = distance
ClosestAttachment = attachment
end
end
end
local floor = mouse.Target
local wall = game.Workspace.wall
wall.Transparency = 0.75
local wallCframe = floor.CFrame *CFrame.new(ClosestAttachment.Position)
wallCframe = wallCframe *CFrame.new(wall.FloorAttachment.Position)
wallCframe = wallCframe *CFrame.Angles(0, math.rad(ClosestAttachment.Orientation.Y), 0)
wall.CFrame = wallCframe
WallPos = wall.Position
else
local wall = game.Workspace.wall
wall.Transparency = 1
end
Tool.Unequipped:Connect(function()
ToolEquiped = false
local wall = game.Workspace.wall
wall.Transparency = 1
end)
end
end
ima using attachments and i belive the main peice of code to get it to rotate is *wallCframe = wallCframe CFrame.Angles(0, math.rad(ClosestAttachment.Orientation.Y), 0) but it dosent rotate at all any solutions? my discord is localLuser#4076
