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

How do I fix a model move to issue, where it would move toward you instead of outward if needed?

Asked by 4 years ago

Ok so I have been doing lua for quite a while yet I still run into issues, is there any way I could fix this?

here is the video link to my issue: https://www.youtube.com/watch?v=xtiGcpcPlvY

here is my script: 
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local x = mouse.X
local y = mouse.Y
local mtarget
local down
local treenames = {'AppleTree','BeginnersTree'}
for _,v in pairs(treenames) do
    print(v)
    mouse.Button1Down:connect(function()
        if mouse.Target ~= nil and mouse.Target.Parent.Name == v then
            mtarget = mouse.Target.Parent
            print(mouse.Target.Parent.Name)
            down = true
            mouse.Move:connect(function()
                if down and mtarget ~= nil then
                    mtarget:MoveTo(mouse.Hit.p,x,y)
                end
            end)
            mouse.Button1Up:connect(function()
                down = false
                mtarget = nil
            end)
        end
    end)
end
0
i'm not sure but this might be on roblox. maybe set it to a certain y so it doesnt come floating to you? (just a random solution for a flat baseplate) speedyfox66 237 — 4y
0
Alright thanks! AntoninFearless 622 — 4y

Answer this question