Okay, so I made a NPC which you can talk you and he spawns in 10 eggs when he’s done with talking. Works perfectly. Only thing is that the eggs don’t change my leaderstats. And when I place when in workspace using the explorer they work how I want them to.
local db = true
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if db == true then
db = false
script.Parent.Transparency = 1
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.Eggs.Value = player.leaderstats.Eggs.Value + 1
script.Parent.Transparency = 1
end
end
end)
db = true
The problem can be that you are moving parts using local script. Anything created by local script can’t edit server side like leaderstats. Try to move parts using normal script