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

Mouse.Hit.P Moving Up?

Asked by 7 years ago
Edited 7 years ago

When using Mouse.Hit.p, I came across a problem, when I say

model:MoveTo(mouse.Hit.P)

the model is always moving up when it is meant to only be moving on the ground, here is my script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local function getKey()
    mouse.KeyDown:connect(function(Key)
        if Key == "x" then
            return true
        end
    end)
end

local function place(model, clone)
    assert(model:IsA("Model"), "Please insert a propper name to insert.")
    if clone then
        local thing = model:Clone()
        thing.Parent = workspace
        if thing then
            local player = game.Players.LocalPlayer
            local mouse = player:GetMouse()
            repeat
                wait()
                thing:MoveTo(mouse.Hit.p)
            until getKey() == true
        end
    end
end



script.Parent.Road.MouseButton1Click:connect(function()
    place(game.ReplicatedStorage.Models.Road, true)
end)
0
I have this same problem connor12260311 383 — 7y

Answer this question