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

Error with printing a players lobby?

Asked by 8 years ago

The goal is the give a player their own spawn box, and in the workspace there is Lobby1 through Lobby10. But the issue is, the i try to get this lobby through a value with a number, 1 - 10,i get the error : attempt to concatenate local 'lobbys' (a userdata value)

1player = game.Players.LocalPlayer
2local spawn = script.Parent.spawn
3local lobbys = game.Workspace.Lobbys
4local locallobby = lobbys..spawn.Value
5wait(1)
6spawn.Value = game.Workspace.Values.Numspawns.Value
7print(locallobby)
8player.Character:MoveTo(Vector3.new(0,0,0))

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

On line 4 you're concatenating an object with a string, which will error. To fix this you'll have to change "lobbys..spawn.Value" to "lobbys.Name..spawn.Value"

Ad

Answer this question