I have problem with my script. When player reset it doesn’t work. If I use another proximity prompt it shows me that the object from another prompt is not child of workspace and humanoid.Died function is not working.
Local Script:
local gui = script.Parent
local plr = game.Players.LocalPlayer
local hum = plr.Character:WaitForChild("Humanoid")
local event = game:GetService("ReplicatedStorage"):WaitForChild("EggGivingEvent")
local leaderstats = plr:WaitForChild("leaderstats"):WaitForChild("hiddenfolder"):WaitForChild("Eggs")
game.Workspace.EasterEgg1.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg1:Destroy()
end)
game.Workspace.EasterEgg2.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg2:Destroy()
end)
game.Workspace.EasterEgg3.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg3:Destroy()
end)
game.Workspace.EasterEgg4.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg4:Destroy()
end)
game.Workspace.EasterEgg5.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg5:Destroy()
end)
game.Workspace.EasterEgg6.ProximityPrompt.Triggered:Connect(function()
event:FireServer()
game.Workspace.EasterEgg6:Destroy()
end)
leaderstats:GetPropertyChangedSignal("Value"):Connect(function()
gui.Text = leaderstats.Value
end)
hum.Died:Connect(function()
wait()
gui.Text = leaderstats.Value
end)