So, I have a game where you collect eggs. The code where the Touched() event happens is done on the client’s side. The humanoid touches the egg, the Touched() event fires, and the egg is discovered. After the player respawns, the code does not work. There are no errors that print in the console.
Character is defined as Player.Character or Player.CharacterAdded:Wait()
This is the code.
Character.Humanoid.Touched:Connect(function(eggPart)
if eggPart:IsDescendantOf(EggModelsParent) then
if not EggDebounce then
EggDebounce = true
local eggData = {
egg = eggPart,
eggClass = string.split(eggPart.Name, "_")[1];
eggName = string.split(eggPart.Name, "_")[2];
eggBehaviour = string.split(eggPart.Name, "_")[3]
}
if EggFunc_CS:InvokeServer("CheckEggOwnership", eggData) == false then
EggFunc_CS:InvokeServer("AwardEgg", eggData)
HUD.EggList.ScrollingFrame[eggData.eggClass .. "_" .. eggData.eggName].Collected.Visible = true
HUD.EggCollected.EggName.Text = EggFunc_CS:InvokeServer("GetEggName", eggData)
HUD.EggCollected.Visible = true
task.wait(3)
HUD.EggCollected.Visible = false
end
task.wait(5)
EggDebounce = false
end
end
end)
Please only reply in regards to the problem that I am having.