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

Why isn't this working? Doesn't give points when killing another player?

The idea of this script is to give me currency and experience points when I kill another player. However it isn't working.

local cv = c.Humanoid:findFirstChild("creator")
game.Players.PlayerAdded:connect(function(p)
	p.CharacterAdded:connect(function(c)
		c.Humanoid.Died:connect (function()
			if cv then local k = cv.Value if k and k ~= p then
				k.leaderstats.Experience.Value = k.leaderstats.Experience.Value + 100
				k.leaderstats.Currency.Value = k.leaderstats.Currency.Value + 50
		end)
	end)
end)

2 comments

3

This script is really messed up.

0

Agreed, try organizing your script - don't use functions in functions.

1 answer

When you do local cv = c.Humanoid:findFirstChild("creator") the variable c doesn't exist at the time, meaning the script isn't able to find the localc. You would need to replace all the cv's with c.Humanoid:findFirstChild("creator") and then try it. However it still might not work as the script is quite messy.

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