The objective of the script is that after the player picks up the lantern it deletes the mesh, so that the player cannot fill his backpack with lanterns;
So, my problem is that when the Script calls the RemoteFunction that is in the ReplicatedStorage, the Player only takes the flashlight but the Mesh that has the ProximityPrompt is not deleted
Small video showing my problem:
This is probably just a silly mistake, even though I did a quick search I couldn’t find something similar…
local RepStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local ProximityPrompt = script.Parent.ProximityPrompt
local FlashLight = RepStorage.FlashLight
local Remote = RepStorage.RemoteDelete
local function onFlashLightPicked(player)
Remote:InvokeClient(player)
workspace.FlashLightModel:Destroy()
end
ProximityPrompt.Triggered:Connect(function(player)
FlashLight:Clone().Parent = player.Backpack
onFlashLightPicked(player)
end)
Any and all help is welcome