#Need Help With This. It works, but something isn't right

1 messages · Page 1 of 1 (latest)

true raft
#

So i am making this thing where the rectangle moves with the mouse. it works if you move it slowy, but it you go in certain directions or go too fast then it just snaps to the ground and like moves really fast everywhere, but mainly if you move your mouse to fast then it just like snaps into the ground or goes somewhere i cant see. please help with this issue

wraith solar
#

why not give the script that does it with it?

true raft
#

sorry

#

ill do it now

#
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local runService = game:GetService("RunService")
local replicatedStorage = game:GetService("ReplicatedStorage")

-- Clone the rectangle part
local cursorPart = replicatedStorage:WaitForChild("CursorPart"):Clone()
cursorPart.Anchored = true
cursorPart.CanCollide = false
cursorPart.Parent = workspace

-- Character
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")

runService.RenderStepped:Connect(function()
    if not root then return end
    local mouseHit = mouse.Hit
    if not mouseHit then return end

    -- Set cursor part to mouse X/Y (ignore Z for 2D)
    local targetPos = mouseHit.Position
    cursorPart.Position = Vector3.new(targetPos.X, targetPos.Y, 0)
end)
#

*heres the script for the recttangle cursor

#

rectangle part is stored in replicated storage

cursive depot
#

Can you format it?

#

Put 3 of these at the top and bottom

`

#

Of the script

true raft
#

alright

potent salmonBOT
#

studio** You are now Level 2! **studio

cursive depot
#

Thank you

true raft
#

i have to go rn but if u find an answer or fix u can leave them here ill try them when i get back

cursive depot
#

Aight

valid heart
#

because like the mouse might not be on the part

wraith solar
#

He also wants to set a maximum distance maybe render ?

valid heart
#

the fix for this depends on for example, is it possible to enable or disable it

#

how do you disable it