So, this is my code thus far. It errors on line 14, due to my variable of owner
01 | script.Parent.Touched:connect( function (z) |
02 | if script.Parent.Parent.Name = = "UnOwnedTycoon" then |
03 | script.Parent.Parent.Name = z.Parent.Name .. "'s tycoon" |
04 | print (z) |
05 | print (z.Parent) |
06 |
07 | end |
08 | owner = z.Parent.Name |
09 | end ) |
10 |
11 | workspace.Reciever.Touched:connect( function (x) |
12 | if x.Name = = "FlyingMoney" then |
13 | game.Players(owner)leaderstats.Points.Value = game.Players(owner)leaderstats.Points.Value + 1 |
14 | end |
15 | end ) |
When trying to do that instead of FindFirstChild
, you use brackets. Also you need a dot after the brackets (Make sure that "owner" is a string
).
01 | script.Parent.Touched:connect( function (z) |
02 | if script.Parent.Parent.Name = = "UnOwnedTycoon" then |
03 | script.Parent.Parent.Name = z.Parent.Name .. "'s tycoon" |
04 | print (z) |
05 | print (z.Parent) |
06 | end |
07 | owner = z.Parent.Name |
08 | end ) |
09 |
10 | workspace.Reciever.Touched:connect( function (x) |
11 | if x.Name = = "FlyingMoney" then |
12 | game.Players [ owner ] .leaderstats.Points.Value = game.Players [ owner ] .leaderstats.Points.Value + 1 --Brackets and a dot, like that. |
13 | end |
14 | end ) |
Otherwise the script works and is efficient enough.