Help Guys Align My Part
Server Script :
local TrowelEvent = game.ReplicatedStorage.ToolsService.TrowelPlacement
local part = game.ReplicatedStorage.Block
TrowelEvent.OnServerEvent:Connect(function(Player, targetPos)
local brick = part:Clone()
brick.Anchored = true
brick.Position = targetPos
brick.Parent = game.Workspace
wait(5)
brick:Destroy()
end)
This Is A Local Script
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local TrowelEvent = game.ReplicatedStorage.ToolsService.TrowelPlacement
local part = game.ReplicatedStorage.Block
local debounce = false
local mouse = Player:GetMouse()
Tool.Activated:Connect(function()
if debounce then return end
debounce = true
local targetPos = mouse.Hit.Position
local Normal = mouse.TargetSurface
if mouse.TargetSurface then
if Normal == Enum.NormalId.Back then
targetPos += Vector3.new(0, 0, 3.3)
TrowelEvent:FireServer(targetPos)
print(Normal)
elseif Normal == Enum.NormalId.Right then
targetPos += Vector3.new(3.2, 0, 0)
TrowelEvent:FireServer(targetPos)
print(Normal)
elseif Normal == Enum.NormalId.Top then
targetPos += Vector3.new(0, 0.3, 0)
TrowelEvent:FireServer(targetPos)
print(Normal)
elseif Normal == Enum.NormalId.Left then
targetPos += Vector3.new(-3.2, 0, 0)
TrowelEvent:FireServer(targetPos)
print(Normal)
elseif Normal == Enum.NormalId.Bottom then
targetPos += Vector3.new(0, -0.3, 0)
TrowelEvent:FireServer(targetPos)
print(Normal)
elseif Normal == Enum.NormalId.Front then
targetPos += Vector3.new(0, 0, -3.3)
TrowelEvent:FireServer(targetPos)
print(Normal)
end
end
wait(5)
debounce = false
end)
Everything Works Good, But Part Always Look Forward, Instead Of Reacting To Corners, Like 45 Degrees