We looked at his game place and it turns out that the team was changing from a local script instead of a server script.
We ended up creating a script that changes the player’s team through a server script:
local gui = script.Parent
local player = script.Parent.Parent.Parent
for _, child in pairs(script.Parent:GetChildren())do
local index = child.Name:find("Selection")
--if the child is a team selection button:
if index then
--change team on button click:
local teamName = child.Name:sub(1, index-1)
print(teamName)
child.MouseButton1Click:connect(function()
gui.Enabled = false
player.Team = game:GetService("Teams"):FindFirstChild(teamName)
end)
end
end
It’s not about Lua being able to tell the datatype. In code similar to local x = {y = z}, z will always be saved at index “y” (y would always be a string). It’s similar to why x.y doesn’t require the quotes.