This is the script i used in the zombie when i killed a zombie i got money i tried changing it for when a turret kills a zombie you get cash. also the turret is in a turret.

local Humanoid = script.Parent.Turret1
function PwntX_X() 
	local tag = Humanoid:findFirstChild("creator") 
	if tag ~= nil then 
		if tag.Value ~= nil then 
			local Leaderstats = tag.Value:findFirstChild("leaderstats") 
			if Leaderstats ~= nil then 
				Leaderstats.Cash.Value = Leaderstats.Cash.Value + 1000000 
				wait(0.1) 
				script:remove() 
			end 
		end 
	end 
end 
Humanoid.Died:connect(PwntX_X) 

2 comments

0

Might want to format your code correctly, it's hard to understand what's going on there.

0

ok