Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
vinboi 0
8 years ago

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

0
What is 's'? Is the name of the object "Points"? What are you trying to do there. Goulstem 8144 — 8y
0
player.leaderstats["Point(s)"].Value Pyrondon 2089 — 8y
0
^ User#11440 120 — 8y

1 answer

Log in to vote
0
Answered by
Voltoxus 248 Moderation Voter
8 years ago

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

Ad

Answer this question