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

Adding a value into this?

Asked by
traigla 75
10 years ago

How do I sort this out?

        local Name = Player.Name
        PlayerCar = game.Workspace..(Name).Car

I want to be able to make it go into the Workspace and find the Name of the player then inside it 'Car' which is a model.

1 answer

Log in to vote
1
Answered by
gskw 1046 Moderation Voter
10 years ago

Try this:

local Name = Player.Name
local PlayerCar = workspace[Name].Car
1
Further detail: When you say `A.B`, what is happening behind the scenes is `A["B"]`. So `game.Workspace` is the same as `game["Workspace"]`; consequently, if you have `name = "Workspace";` then `game[name]` that is also Workspace BlueTaslem 18071 — 10y
Ad

Answer this question