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

Why wont this onEntered work?[UNSOLVED]

What this is supposed to do is when you join, it gives you a random element, makes a message saying your element and then clone the element tool from Lighting into the players backpack. There are no errors in the script but it wont work.

function onPlayerAdded(Player)
	Player:WaitForDataReady()
	Chakra = Instance.new("StringValue", Player)
	Chakra.Name = "Chakra"
	if Player:LoadString("Chakra") ~= "" then
		Chakra.Value = Player:LoadString("Chakra")
	else
		Elements = {"Water","Lighting","Fire","Wind","Earth"}
		i = math.random(1,#Elements)
		Players.Chakra.Value = Elements[i]
		Player:SaveString("Chakra", Player.Chakra.Value)
		Message = Instance.new("Message", Workspace)
		Message.Text = Chakra.Value
		game.Debris:AddItem(Message,10)
	end
	if Player.Chakra.Value == "Fire" then
		x = game.Lighting.Fireball:clone()
	elseif Player.Chakra.Value == "Water" then
		x = game.Lighting.Water:clone()
	elseif Player.Chakra.Value == "Lighting" then
		x = game.Lighting.Lighting:clone()
	elseif Player.Chakra.Value == "Wind" then
		x=game.Lighting.Wind:clone()
	elseif Player.Chakra.Value == "Earth" then
		x=game.Lighting.Earth:clone()
	end
	x.Parent = Player.Backpack
end

game.Players.PlayerAdded:connect(onPlayerAdded)

1 comment

0

Random downvoters...

1 answer

✓ Accepted answer

You have a typo on Line 10.

Players.Chakra.Value = Elements[i]

"Players" is not defined. However, "Player" is defined.

2 comments

0

Thanks so much :)

0

No problem. Please don't forget to Up Vote as well!

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