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

Move model to mouse in studs?

Asked by 6 years ago

I made a script that when you click a GUI button, it will clone an object and allow you to place it somewhere. The script works, the object follows the mouse until clicked again and then is placed where it needs to be, however I need it to move like a grid such as like miners haven.

01local debounce = false
02local player = game.Players.LocalPlayer
03local mouse = player:GetMouse()
04local objects = game.ReplicatedStorage.Objects
05local ob = script.Parent.Object
06script.Parent.MouseButton1Click:connect(function()
07    if debounce == false then
08        debounce = true
09         part = objects:FindFirstChild(ob.Value)
10            if part then
11                part.Position = Vector3.new(0,0,0)
12                clone = part:Clone()
13                clone.Name = "Clone"
14                clone.Parent = game.Workspace
15                local owner = Instance.new("StringValue", clone)
View all 36 lines...

Any help would be appreciated. -Wizy

0
math.floor() http://wiki.roblox.com/index.php?title=Global_namespace/Mathematical_functions&redirect=yes#math.floor theCJarmy7 1293 — 6y
0
there is a huge equation for studs... greatneil80 2647 — 6y

Answer this question