I really hope this is not a localscript
LocalPlayer
can only be accessed by scripts running on the client, or localscripts
. Seeing as this script is in workspace, it would not have access to this.
In order to fix this script, you need to get the part that touched the brick, see if its part of a player and get the player from Players
.
01 | script.Parent.Touched:Connect( function (Touched) |
02 | if Touched.Parent:FindFirstChild( "Humanoid" ) then |
03 | plr = game.Players:GetPlayerFromCharacter(Touched.Parent) |
04 | if plr.leaderstats.Anthros.Value > 100000 then |
05 | local tpservice = game:GetService( "TeleportService" ):Teleport( 997334876 ) |
07 | error ( "User doesn''t have 100,000 anthros, error 1." ) |