So basically I have this:
player.CharacterAdded:Connect(function(char)
local mouse
repeat
mouse = player:GetMouse()
RunService.Heartbeat:Wait()
until mouse
local holdingMouse = false
mouse.Button1Down:Connect(function() holdingMouse = true end)
mouse.Button1Up:Connect(function() holdingMouse = false end)
local lastPos
RunService.Heartbeat:Connect(function()
if holdingMouse then
local target = mouse.Target
if target and partToIndex[target] then
local currentPos = target.Position
-- Draw the current target
onPartDrawn(player, target)
-- Draw intermediate parts between lastPos and currentPos
if lastPos then
local dist = (currentPos - lastPos).Magnitude
local steps = math.max(1, math.floor(dist / 2)) -- one part per ~2 studs
for i = 1, steps do
local interpPos = lastPos:Lerp(currentPos, i / steps)
local ray = Ray.new(interpPos + Vector3.new(0, 5, 0), Vector3.new(0, -10, 0))
local partHit = Workspace:FindPartOnRayWithIgnoreList(ray, {char})
if partHit and partToIndex[partHit] then
onPartDrawn(player, partHit)
end
end
end
lastPos = currentPos
else
lastPos = nil
end
else
lastPos = nil
end
end)
end)
end)
It is a script to make my 258ish blocks a canvas I can draw on, but it only allows me to click on each individually and sometimes it just doesn't work. Anyone know a fix?