Hello, I am trying to remove a part by touching another and the part locally but the part I touched gets deleted on the server
Simpler way to explain: I touch part B, it destroys part A to the person who touched it, part B is deleted on the server
Script on Part B
script.Parent.Touched:Connect(function(hit) script.Parent:Destroy() end)
Local script on Part B
function onTouch(part) game.ReplicatedStorage.PINK:FireServer() end
script.Parent.Touched:connect(onTouch)
Local script I have on Part A
game.ReplicatedStorage.PINK.OnClientEvent:Connect(function() script.Parent:Destroy() end)
It destroys part B but doesn't destroy part A
local scripts doesn’t work in workspace. try putting the local script in startergui and the local scripts should be like this
part a local script (in startergui)
game.ReplicatedStorage.PINK.OnClientEvent:Connect(function() workspace.PartA:Destroy() end)
part b script (in workspace inside of part b)
script.Parent.Touched:Connect(function(hit) if hit and hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then script.Parent:Destroy() game.ReplicatedStorage.PINK:FireClient(game.players:GetPlayerFromCharacter(hit.Parent)) end end)