this is my local script, i want the script to delete the part the the players mouse is pointing at on the server not just the client

local plr = game.Players.LocalPlayer local uis = game:GetService("UserInputService") local mouse = plr:GetMouse() local RS = game:GetService("ReplicatedStorage") local eraser = RS:WaitForChild("eraser")

uis.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.F then mouse.Target:Destroy() print("deleted") eraser:FireServer(mouse.Target) end end)

this my server script

local RS = game:GetService("ReplicatedStorage") local eraser = RS.eraser

eraser.OnServerEvent:Connect(function(player) local mouse = player:GetMouse() mouse.Target:Destroy() end)

2 comments

0

You cannot use :GetMouse() on the server

0

Plus why send the target with the FireServer and not make use of that to destroy