Hello! I'm trying to make a cursor that is a part move around in the 3d Roblox world, and then make it into a place box afterward so players see where they are placing items like traps, landmines, etc, Right now the problem is that the cursor spawns in, but it doesn't move and it just stays at 0,0,0. I scanned through the console but I didn't find anything related to this script.
I've tested this in studio, and in the experience, the same result it doesn't move. Attempts: I've tried to optimize the code and remove while true loops, I went from using x, y to .hit after looking at some documentation, but other than that I am totally lost.
cursorstorage = a folder in the workspace.
This script is in a tool, in workspace.
This script is a local script.
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
script.Parent.Equipped:Connect(function()
local cursor = Instance.new("Part")
cursor.Color = Color3.fromRGB(255, 255, 255)
cursor.Material = Enum.Material.Neon
cursor.Size = Vector3.new(0.5, 0.5, 0.5)
cursor.Transparency = 0.5
cursor.Parent = game.Workspace.cursorstorage
cursor.Anchored = true
cursor.Name = ("Cursor")
mouse.Move:Connect(function(moved)
cursor.Position = Vector3.new(mouse.Hit.Position)
end)
end)
script.Parent.Unequipped:Connect(function()
if game.Workspace.cursorstorage:FindFirstChild("Cursor") then
game.Workspace.cursorstorage.Cursor:Destroy()
end
end)
Any help is appreciated! full solutions to just suggestions to clean up my code, make it more optimized, or just thoughts on how it could be fixed, Thank you.

1 comment
Oh thank you so much!