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

how do I make my script delete the players mouse target on the server and client?

Asked by 2 years ago

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)

0
You cannot use :GetMouse() on the server Protogen_Dev 268 — 2y
0
Plus why send the target with the FireServer and not make use of that to destroy Protogen_Dev 268 — 2y

Answer this question