Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This wont add anything to the leaderrboard?

I'm trying to make this when zombie gets kills it adds 8 heads to the leaderboard but its not working!!! please help

local Humanoid = script.Parent.Zombie -- Or Zombie Or Whatever 
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.Heads.Value = Leaderstats.Heads.Value + 8
wait(0.1)
script:remove()
			end 
		end 
	end 
end 
Humanoid.Died:connect(PwntX_X) 

1 answer

Be sure you actually create the leaderboard and properly tag your coding so it is easy to read. To create the leaderboard, you have to create a separate script to address when a player enters. Here is an example code of leaderboard creation.

local pls = game:GetService("Players")
OnEnter = function(player)
	local leaderstats = Instance.new("IntValue",player)
	leaderstats.Name = "leaderstats"
	local heads = Instance.new("IntValue",leaderstats)
	heads.Name = "Heads"
	heads.Value = 0
end
pls.PlayerAdded:connect(OnEnter)
--Just to make sure everyone gets one
local a = pls:GetChildren()
for i=1,#a do
	OnEnter(a[i])
end

1 comment

0

this wotn work

This discussion is preserved as it was. New answers, comments, and votes are closed.