Prevent deletion when item picked up

Ight so, I’ve made a hat drop script, when you drop the hat it starts a wait(10) timer. After that time expires it deletes the hat. Issue is that it destroys it after I’ve picked up the hat. The solution i’ve had in my mind would be a Bool value. But, I feel like i could be a bit more efficient.

Check if it’s not Parent of workspace.

wait(10)
if Hat.Parent ~= workspace then
	Hat:Destroy()
end

Oh, this is a very simple solution. This would work on local correct? Or would it only delete clientsided

Put it in the Script so it deletes for all players. However if your Hat is only client sided then use LocalScript.

This does not work. Wont delete now at all

Is your system client sided or is it server sided?

1 Like

The dropping is clientsided while picking up is server sided

They both should be on the server if you want other players to be able to pick it up and the item deletion to be synced

edit : server

example : the player drops the item and you fire a remote and it puts the item in workspace and you also tie to that specific item a deletion countdown

Wouldn’t i have to use a remote for that. Old roblox had a feature where you could drop your hats. Idk if they were deleted after a while though

Well is this a hat you custom made or is it an actual hat accessory because I think when you drop those its replicated

Actual hat, if its replicated then i can just destroy it client sided correct?

Well not necessarily, you can drop it client sided and other players can pick it up and see that you dropped it but your gonna have to delete it server side for it to be gone for all the players