So I have a script which is supposed to function so that if i say :add cantbeatmerbro levels Its will give the player a point.

																										~~~~~~~~~~~~~~~~~

]] local groupId =

3809018


local dataStore = game:GetService("DataStoreService"):GetDataStore("UserCredits")

if game.CreatorType == Enum.CreatorType.Group then
	groupId = game.CreatorId
elseif game.CreatorType == Enum.CreatorType.User and groupId < 1 then
	local hint = Instance.new("Hint",game.Workspace)
	hint.Text = "YouFoundJojo's Leaderboard - Uh oh! Group ID was not found! Please try again!"
	game:GetService("Debris"):AddItem(hint,30)
end
game.Players.PlayerAdded:connect(function(player)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	stats.Parent = player

	local credits = Instance.new("IntValue")
	credits.Name = "Levels"
	credits.Parent = stats
	
	if groupId > 0 then
		local rank = Instance.new("StringValue")
		rank.Name = "Rank"
		rank.Value = player:GetRoleInGroup(groupId)
		rank.Parent = stats
	end
	
	if dataStore:GetAsync("Key" .. player.UserId) then
		credits.Value = dataStore:GetAsync("Key" .. player.UserId)
	else
		credits.Value = 0
	end
	
	credits.Changed:connect(function(save)
		dataStore:SetAsync("Key" .. player.UserId, save)
	end)
end)

The script wont work in my game however it works in my friends game which is really odd. The goal is that player from my group whohave a rank of 254+ should be able to give players points using :add cant levels 1

If anyone can help it would be much appreciated!!

2 comments

0

I wouldn't have the player giving script and datastorescript in the same script, but thats just me. You said it works in your friends game, is your friends game a group game and yours isnt?

0

both of ours are group games