GUI not appearing after death

Hello!

So I’ve been working on a PickUp System where if you hover your mouse over an object it will pop up a billboard GUI.

Now just one tiny issue. Once I reset myself and hover my mouse over the tool it won’t work.

I tried turning off the resetonspawn property but that didn’t work. I tried a bunch of other things and those options didn’t work either and that’s why i’m here.

The Code is probably not the problem as I troubleshooted it.

There is likely some code logic issue contributing to the unwanted behavior, you should share the code.

1 Like

Show me the code as I know what it might be

Here’s the code

local Script

local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
local backpack = player:WaitForChild("Backpack")
local dropevent = game.ReplicatedStorage.Drop

local hadToolEquipped = false

humanoid.Died:Connect(function()
	for i, tool in pairs(character:GetChildren()) do
		if tool:IsA("Tool")then
			dropevent:FireServer(hadToolEquipped, tool, character)
		end
	end
end)

Server Script:

local dropevent = game.ReplicatedStorage.Drop

dropevent.OnServerEvent:Connect(function(player, hadToolEquipped, tool, character)
	hadToolEquipped = true
	tool.Parent = game.Workspace.DroppedWeapons
	local equippedTool = player.Backpack:FindFirstChildOfClass("Tool")
	
	if equippedTool then
		equippedTool.model.CFrame = character.HumanoidRootPart.CFrame
		equippedTool.model.Anchored = false
		wait(1)
		equippedTool.model.Anchored = true
	end
end)

You’re trying to change a variable (which was defined on the client), but you can’t do that because it is not the same script. Instead, you could put that inside the humanoid died function.

Also, you did not need to include the player character in the event argument. You can just reference it in the server script using player.Character.

I have modified your two scripts, since the hadToolEquipped argument is irrelevant in the dropevent.

Server Script
local dropevent = game.ReplicatedStorage:WaitForChild("Drop")

dropevent.OnServerEvent:Connect(function(player, tool)
    local character = player.Character
	tool.Parent = game.Workspace.DroppedWeapons
	local equippedTool = player.Backpack:FindFirstChildOfClass("Tool")

	if equippedTool then
		equippedTool.model.CFrame = character.HumanoidRootPart.CFrame
		equippedTool.model.Anchored = false
		wait(1)
		equippedTool.model.Anchored = true
	end
end)
LocalScript
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
local backpack = player:WaitForChild("Backpack")
local dropevent = game.ReplicatedStorage.Drop

local hadToolEquipped = false

humanoid.Died:Connect(function()
	for i, tool in pairs(character:GetChildren()) do
		if tool:IsA("Tool")then
			hadToolEquipped = false
			dropevent:FireServer(tool)
		end
	end
end)

Can you show us the script that’s actually related to the gui lol

Thank you man you saved me :slight_smile: Much appreciated.