The script below clones the block where the player clicks, but the thing is that the detail should appear from the place where we clicked, that is, if I click on a square, the detail will appear in the center of the square, and not from its extreme side
TrowelEvent.OnServerEvent:Connect(function(Player, targetPos) -- Добавляем targetPos как параметр
local brick = part:Clone()
brick.Anchored = true
brick.Position = targetPos -- Используем переданную позицию
brick.Parent = game.Workspace
wait(5)
brick:Destroy()
end)
What Im Need
To Get Pos Im Used -
local mouse = Player:GetMouse()
local targetPos = mouse.Hit.Position
TrowelEvent:FireServer(targetPos)
Thanks!
1 Like
Get the Position and add the Size of the part divided by 2, I also tried making a building system and this worked for me, at least for the y axis,
CFrame.new(Mouse.Hit.Position)+Vector3.new(0,Part.Size.Y/2,0)
3 Likes
I’ve got error
Unable to assign property Position. Vector3 expected, got CFrame
2 Likes
Because im using CFrame and your using vectors, heres the full line in mine.
Part.CFrame = CFrame.new(Mouse.Hit.Position)+Vector3.new(0,Part.Size.Y/2,0)
2 Likes
I’ve tried this
local targetPos = mouse.Hit.Position + Vector3.new(0, part.Size.Y/2, 0)
nothing, i must use cframe?
can u provide full code if u can, im just asleep
2 Likes
Use
brick:PivotTo(CFrame.new(targetPos))
2 Likes
Sorry, But nothing
local part = game.ReplicatedStorage.Block
TrowelEvent.OnServerEvent:Connect(function(Player, targetPos)
local brick = part:Clone()
brick:PivotTo(CFrame.new(targetPos))
brick.Anchored = true
brick.Position = targetPos
brick.Parent = game.Workspace
wait(5)
brick:Destroy()
end)
Im Correct?
1 Like