Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

mouse.Target isn't working properly, why?

Asked by 3 years ago

I'm working on a grid shot aim trainer on roblox but after i hit 3 blocks, mouse.Target isn't detecting anymore, why?

here is the video link. https://streamable.com/kyduu8

local script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Button1Down:Connect(function()
    print("hii")
    if mouse.Target.Name == "Box" then
        print(mouse.Target.Name)
        game.ReplicatedStorage.newbox:FireServer(mouse.Target)
    end
end)

server script:

game.ReplicatedStorage.newbox.OnServerEvent:Connect(function(plr,v)
    v:Destroy()
    local b = v:Clone()
    b.Parent = workspace
    b.Name = "Box"
    b.Position = workspace.Grid[tostring(math.random(1,9))].Position
    b.Size = Vector3.new(3,3,3)
    print(b.Position)
end)

Answer this question