Proximity Prompt Doesn't Show Up After The Character Dies

I’m making a lootdrop system, when you died a proximity prop will show up “Search”, it’s loop through to the character checking if there is a tool, if there is it’s gonna parent to that character backpack, but when i died again it’s doesn’t show up anymore? is there solution to this?

Module :

local module = {}

function module.PickUp(char)
	local prop = Instance.new("ProximityPrompt")
	prop.Parent = char
	prop.KeyboardKeyCode = Enum.KeyCode.E
	prop.ActionText = "Search"
	
	prop.Triggered:Connect(function(player)
		local bp = player.Backpack
		for _, item in pairs(char:GetChildren()) do
			if item:IsA("Tool") then
				item.Parent = bp
			end
			if game.Players[char.Name]:FindFirstChild("Backpack") then
				for i, tool in pairs(game.Players[char.Name].Backpack:GetChildren()) do
					tool.Parent = bp
				end
			end
		end
	end)
end

return module

Server :

local remote = game.ReplicatedStorage.Remotes:WaitForChild('Lootdrop')
local pickupModule = require(game.ReplicatedStorage.Modules:WaitForChild("PickUpModule"))
remote.OnServerEvent:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	pickupModule.PickUp(char)
end)

The lootdrop system does work, but only the proximity prop doesn’t show up after died again.

Use #help-and-feedback:scripting-support and try using “`” three times

Like so

No errors in the output?

No error in the outputs, btw i tried everything doesn’t works

When do you fire the remote on the client? When the player dies?

There appears to be a delay in the codes execution when the player dies.
If you handle your Ragdoll system on the Server, it tends to be delayed.

It works, its just the Death effect being delayed.

local remote = game.ReplicatedStorage.Remotes:WaitForChild('Lootdrop')

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

hum.Died:Connect(function()
	remote:FireServer()
end)

this is the client

I converted the ragdoll script to local script, i once test again it’s doesn’t show up.

I believe the problem is that the code below only runs once, when the player first enters the game

local char = plr.Character or plr.CharacterAdded:Wait()

After each death you get a new character so the char variable only remembers the previous character which now doesn’t exist because of it’s death/destruction.

I recommend you listen to the players death from the server.

game.Players.PlayerAdded:Connect(function(plrWhoJoined)
    plrWhoJoined.CharacterAdded:Connect(function(newChar)
        local humanoid = newChar:WaitForChild("Humanoid")

        humanoid.Died:Connect(function()
        -- run your module
        end)
    end)
end)
1 Like

tyy so much, it’s working. the problem is fixed.

1 Like

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