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

Scripting error, What do I do?

local playerStats = {} --this keeps a list of the stats for each player that enters the game
 
 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"
 
     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = "Rank"
	 local rank = player:GetRoleInGroup(1070236) -- Insert the group ID for whatever group you want ranks displayed for here. 
	
     if rank ~= 0 then
		 grouprank.Value = rank
 	 else
		 grouprank.Value = "Join U.F.P."
	 end
 
     playerStats[player] = leaderstats 
 end)


local playerstats = {}
game.Players.PlayerAdded:connect (function (player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "Allies"
end


local playerstats = {}
 
 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "Enemy"
end

But my question is... It says ')' expected (to close '('at line 22) near 'local' But when I do it line 22 gets underlined red and it says '(' expected near ')' What do I do?

1 answer

✓ Accepted answer
local playerStats = {} --this keeps a list of the stats for each player that enters the game

 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"

     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = "Rank"
     local rank = player:GetRoleInGroup(1070236) -- Insert the group ID for whatever group you want ranks displayed for here. 

     if rank ~= 0 then
         grouprank.Value = rank
     else
         grouprank.Value = "Join U.F.P."
     end

     playerStats[player] = leaderstats 
 end)


local playerstats = {}
game.Players.PlayerAdded:connect (function (player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "Allies"
end) --you forgot to close this one


local playerstats = {}

 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "Enemy"
end) -- and also this one

2 comments

0

Thanks!

1

nps c;

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