[Solved] RemoteFunction does not delete the Mesh

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 :slight_smile:

Why not use a RemoteEvent?
charcharschars

You can just move it elsewhere:

local RepStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local ProximityPrompt = script.Parent.ProximityPrompt
local Remote = RepStorage.RemoteDelete

local function onFlashLightPicked(player)
	Remote:InvokeClient(player)
    workspace.FlashLightModel.Parent = game.ReplicatedStorage
end

ProximityPrompt.Triggered:Connect(function(player)
	RepStorage:FindFirstChild("FlashLight").Parent = player.Backpack
	onFlashLightPicked(player)
end)
1 Like

It’s a server script

charsss

1 Like

bruh im stupid :skull:
charscharschars

1 Like

That worked
Thanks a lot man!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.