I am making a pointer script where a pointer follows the mouse. However the pointer should only be visible to a player when the mouse is pointing to the baseplate.
Script
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local pointer=Instance.new("Part",(game.Workspace))
pointer.Name=("pointer")
pointer.Shape=("Ball")
pointer.BrickColor=BrickColor.new("Really red")
pointer.Size=Vector3.new(0.5,0.5,0.5)
pointer.TopSurface=("Smooth")
pointer.BottomSurface=("Smooth")
pointer.Anchored=true
pointer.Transparency=0
mouse.Move:connect(function()
if mouse.Target then
if mouse.Target.Name=="BasePlate" then
local cframe=mouse.Hit
pointer.CFrame=(cframe)
pointer.Transparency=0
else
pointer.Transparency=1
end
end
end)
My problem here is that the pointer disappears not only when the target is not baseplate but also when the mouse stops moving. when the mouse moves on top of baseplate is the only time that it is visible. Someone please tell me how to do what i want to do?
