So i am a tool that when you click on a certain block it destroys the block. but when i broadcast mouse.Target it always seems to be the humanoid even if the name of it is "Stone". Client side code:
local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer local backpack = localPlayer:WaitForChild("Backpack") local tool = Instance.new("Tool") tool.RequiresHandle = false tool.CanBeDropped = false tool.Parent = backpack tool.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() if mouse.Target and mouse.Target.Parent then game.ReplicatedStorage.DestroyBlock:FireServer(mouse.Target) print(mouse.Target.Name) end end) end)
Server side code:
game.ReplicatedStorage.DestroyBlock.OnServerEvent:Connect(function(part) part:Destroy() end)
Thank you!
Make sure you add player as one of the parameters.
game.ReplicatedStorage.DestroyBlock.OnServerEvent:Connect(function(plr, part) part:Destroy() end)