Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do i make my placement grid more accurate?

Asked by 5 years ago

How do i make the placement more correct and accurate?

Heres my script so far:

01Run.Stepped:Connect(function(plays)
02    if builded ~= nil then
03        if builded.Type.Value == "Wall" then
04            local mag = math.huge
05 
06            local grid
07 
08            for i, v in pairs(game.Workspace.Grids:GetChildren()) do
09                local magger = (player.Character.HumanoidRootPart.Position - v.Position).magnitude
10 
11                if magger < mag then
12                    mag = magger
13 
14                    grid = v
15                end
View all 23 lines...

Heres a video of the result

https://gyazo.com/fbb783805eb280d6dffedae7f202fa3d

So how do i fix it?

thanks

0
Hmm... I am not to shure... SharkOwen_dev 69 — 5y

1 answer

Log in to vote
0
Answered by
compUcomp 417 Moderation Voter
5 years ago

The problem might be in the CFrame manipulation you do after you chose the grid point. Remove line 18 and replace line 9 with

1local magger = (player.Character.HumanoidRootPart.CFrame * Vector3.new(0, 0, -10) - v.Position).Magnitude
0
My building is now gone, i check its properties and its Y value is repeatedly going up..? ChrisTheRobloxPlayYT 256 — 5y
0
That would be the fault of line 20. Remove that too. compUcomp 417 — 5y
Ad

Answer this question