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

(Vector3 expected, got number) error for vector3value?

Code is simple, when a player joins moves a model to the position of a value, and then add to the value. The code gives the error in the title.

lobby = game.ReplicatedStorage.Lobby

game.Players.PlayerAdded:connect(function(player)
	local i = lobby:Clone()
	i.Parent = workspace.Lobbys
	i:MoveTo(workspace.Lobbys.lastPosition.Value)
	workspace.Lobbys.lastPosition.Value = workspace.Lobbys.lastPosition.Value + 35,0,35
end)

1 answer

✓ Accepted answer

The reason it is erroring is because you are adding to the vector3 value incorrectly. Instead of doing

+ 35,0,35

You should be adding a vector3

+ Vector3.new(35,0,35)

Fixed:

lobby = game.ReplicatedStorage.Lobby

game.Players.PlayerAdded:connect(function(player)
    local i = lobby:Clone()
    i.Parent = workspace.Lobbys
    i:MoveTo(workspace.Lobbys.lastPosition.Value)
    workspace.Lobbys.lastPosition.Value = workspace.Lobbys.lastPosition.Value + Vector3.new(35,0,35)
end)

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