So I have a system setup to move a model around on a grid type system. I got it to work, but everytime I try to decrease the increment it’ll either not work or it’ll work in 1 position then break when you move the mouse further away.
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local mouse = plr:GetMouse()
RunService.RenderStepped:Connect(function()
local function round(n)
return math.floor(n + 0.5)
end
if not game.Workspace:FindFirstChild(plr.Name.."'s Stuff").Temp:FindFirstChild("Object") then
local object = game.ReplicatedStorage.Things.Objects:FindFirstChild(script.Parent.ObjectType.Value):Clone()
object.Parent = game.Workspace:FindFirstChild(plr.Name.."'s Stuff").Temp
object.Name = "Object"
object:MakeJoints()
mouse.TargetFilter = object
end
local part = game.Workspace:FindFirstChild(plr.Name.."'s Stuff").Temp:FindFirstChild("Object")
part:SetPrimaryPartCFrame(CFrame.new(round(mouse.Hit.p.X), mouse.Hit.p.Y + part.PrimaryPart.Size.X/2, round(mouse.Hit.p.Z)))
end)
If you know a way I can decrease the increment (to 0.25 preferably) then I would appreciate it. As well if you need anymore information just ask.
Thanks,
EvolvedAstro.