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
#Need Help With This. It works, but something isn't right
1 messages · Page 1 of 1 (latest)
why not give the script that does it with it?
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
alright
** You are now Level 2! **
Thank you
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
Aight
If you move too fast, the mouse.hit will be nil
because like the mouse might not be on the part
He also wants to set a maximum distance maybe render ?
Like idk what he wants to achieve
the fix for this depends on for example, is it possible to enable or disable it
how do you disable it