hi, so basically i'm having this problem (title), and i do not understand what is wrong. i'm using a remote event (FireServer) to destroy a part (in workspace) that spawns. code:
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function () |
2 | local waa = game.Players.LocalPlayer:FindFirstChild( "NicePartlol" ) |
3 | wait() |
4 | waa:Destroy() |
5 | end ) |
You can use the player parameter for the event 'OnServerEvent'. Since this is a ServerScript, you cannot state the LocalPlayer.
You can replace the variable by doing this:
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (player) |
2 | local waa = player:FindFirstChild( "NicePartlol" ) |
3 | wait() |
4 | if waa = ~ nil then |
5 | waa:Destroy() |
6 | end |
7 | end ) |