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

Group item giver script not functioning well?

So, I made a script in which if you join my group it gives you a certain item. Then, what the problem is that I'm owner and I'm in the rank of Owner. I have 3 more ranks in my group, so what happens is when It gives me the item it gives me 3 of it. How come it does this how can I fix it. I only want one radio for each rank. For example that in my group theres 4 ranks, and if you are the last rank which is 4 it gives you 4 officer radios items, and if you are in rank 3 it gives you 3 officer radios. I dont want that, I want the person who is an any rank from 1-4 to only recieve one officer radio item. I don't want it to give you 4 as if you are in rank 4. Is this a bug?

function PlayerEntered(Player)
   Player.CharacterAdded:connect(function(Char)
      if Player:GetRankInGroup(2539528) >= 255 then
	      if game.Lighting:FindFirstChild("OfficerRadio") then
		      local Flintlock = game.Lighting["OfficerRadio"]:Clone()
		      Flintlock.Parent = Player.Backpack
		   end
      end
   end)
end

game.Players.PlayerAdded:connect(PlayerEntered)

1 answer

✓ Accepted answer

Try using this. I'm not sure if this would fix it because i'm not entirely sure what the problem is, but you haven't gotten any answers, so here ya go:

function PlayerEntered(Player)
	Player.CharacterAdded:connect(function(Char)
		if Player:GetRankInGroup(2539528) >= 255 then
			if game.Lighting:FindFirstChild("OfficerRadio") and not Player.Backpack:FindFirstChild("OfficerRadio") then
				local Flintlock = game.Lighting["OfficerRadio"]:Clone()
				Flintlock.Parent = Player.Backpack
			else 
				print(Player.Name.." has a radio already, foo...silly game.")
			end
		end
	end)
end

game.Players.PlayerAdded:connect(PlayerEntered)

Lol, try this and see if it works. I made it so it checks if the player already has the radio or not, so it should work now, if that was the problem. Hope I helped :P

3 comments

0

Lol this isn't the problem. The problem is that in my group theres 4 ranks, and if you are the last rank which is 4 it gives you 4 officerradios, and if you are in rank 3 it gives you 3 officer radios. I dont want that, I want for each rank to only recieve one radio

0

I fixed the problem by myself ill just accept answer.

0

Oh, ok well sorry I couldn't give the correct answer...thanks for thumbs up tho.

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