I have a script that is supposed to do stuff like team only tools but I get "Unable to cast value to std::string" every time I try to use it. Here's the script.
game.Players.PlayerAdded:connect(function(player)
local starterFolder = game.Teams:findFirstChild(player.TeamColor)
player.CharacterAdded:connect(function(character)
if starterFolder then
starterFolder.PoliceCard:Clone().Parent = player.Backpack
starterFolder.AK47:Clone().Parent = player.Backpack
end
end)
end)

7 comments
how i make code block???????
code blocks are just two sets of 17 ~s
Edited for code block.
And for for code errors, TeamColor is a UserData, while FindFirstChild wants a string
Actually, you can get away with two sets of six ~'s or simply a four space indentation of the entire code block.
Players have a team property which you can use instead of what you are currently using for line 2
the cast value junk is the only error i get