You can now get 30% more when purchasing credits! www.brickplanet.com/upgrade
This script causes a huge error. . .
Posted by Ronaldinho on Feb 28th 2023, 9:00PM
So I made a script and It causes an error saying:

[Debug] Script error: Encountered an internal error, notify the brickplanet staff if the
problem persists. (System.NullReferenceException at Void
SetPlayerTeam(Brickplanet.Scripting.Api. PlayerProxy, System.String)

Lua (at [string "InternalStandardLua"]:40)

I'm making a script about touching a part and switching to that team. So the script is:

Leaderboard.CreateTeam('Barcelona', PartColor.new(0,0,255))


script.Parent.Touched:connect(function(hit)
Leaderboard.SetPlayerTeam('Barcelona')

end)

Is my script itself just incorrect somewhere but the engine isn't telling me or is it just an error because of the limitations of the engine or an internal bug like Hivemind said
Posted by hi on Mar 1st 2023, 6:33AM
you see there is 50439450430 problems with your code probably but its pobably roblox lua because you said createteam and you also said barcelona and bp use hex code
Originally posted by hi on Mar 1st 2023, 6:33AM
you see there is 50439450430 problems with your code probably but its pobably roblox lua because you said createteam and you also said barcelona and bp use hex code
Posted by PurpleSecretAgent on Mar 2nd 2023, 5:25AM
It makes sense.
Originally posted by hi on Mar 1st 2023, 6:33AM
you see there is 50439450430 problems with your code probably but its pobably roblox lua because you said createteam and you also said barcelona and bp use hex code
Posted by Ronaldinho on Mar 2nd 2023, 9:15PM
It ain't roblox lua lol. I used the Brickplanet documentation that's where i got 'CreateTeam' from. Also im pretty sure you put the name of the team in that your wanting to create/set up and so not hex code because

"Leaderboard.CreateTeam('Barcelona', PartColor.new(0,0,255))"

Itself works and creates a team like i made it too

"script.Parent.Touched:connect(function(hit)"
that line refers to the part getting touched and what line it uses under after getting touched. That of course is

"Leaderboard.SetPlayerTeam('Barcelona')"

so idk whats wrong with it rlly please correct my code if your able too and see that it's incorrect
Originally posted by Ronaldinho on Mar 2nd 2023, 9:15PM
It ain't roblox lua lol. I used the Brickplanet documentation that's where i got 'CreateTeam' from. Also im pretty sure you put the name of the team in that your wanting to create/set up and so not hex code because

"Leaderboard.CreateTeam('Barcelona', PartColor.new(0,0,255))"

Itself works and creates a team like i made it too

"script.Parent.Touched:connect(function(hit)"
that line refers to the part getting touched and what line it uses under after getting touched. That of course is

"Leaderboard.SetPlayerTeam('Barcelona')"

so idk whats wrong with it rlly please correct my code if your able too and see that it's incorrect
Posted by p1xat10n on Mar 2nd 2023, 10:02PM
you need to pass a player instance to setplayerteam
Posted by Charge on Mar 6th 2023, 11:46AM
hala madrid
Posted by fnzv3gyh538a4ob3er6d on Mar 20th 2023, 8:00PM
Leaderboard.CreateTeam('Barcelona', PartColor.new(0,0,255))

script.Parent.Touched:Connect(function(hit)
Leaderboard.SetPlayerTeam(hit, 'Barcelona')
end)

your function asks the leaderboard to put nothing in the team because you forgot to include the player in it which is hit