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

How to refer to a variable with keys other than letters ABCD...?

script.Parent.Touched(function(hit) enabled = true

if hit.Parent:FindFirstChild("Humanoid") and enabled == true then
	local player = game.Players.GetPlayerFromCharacter(hit.Parent)
	player.leaderstats.Point(s).Value = player.leaderstats.Point(s).Value + 100
end

end)

Did I name "Point(s)" the right way? I think the () are getting in the way. I remember I'm suppose to do something like putting brackets in but I can't remember how to do it

3 comments

0

What is 's'? Is the name of the object "Points"? What are you trying to do there.

0

player.leaderstats["Point(s)"].Value

0

^

1 answer

✓ Accepted answer

player.leaderstats["Point(s)"].Value

Lua Variable Naming Convetions: Can't start with a number Must start with a letter No spaces use underscores No symbols

To find an object with a symbol or space in it use game.Workspace:FindFirstChild("Namehere") or game.Workspace:WaitForChild("Namehere") or game.Workspace["namehere"].propertyhere

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