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

Giving tools to certain ranks?

I want to give certain weapons to only certain ranks, but it's not showing up in game. What's wrong with the script?

This script is in StarterPack as a normal script.

spyglass = game.Lighting.SpyGlass
flintlock = game.Lighting.Flintlock
musket = game.Lighting.Musket
sabre = game.Lighting.Sabre
swab = game.Lighting.Swab

game.Players.PlayerAdded:connect(function(player)
	    local Rank = player:GetRankInGroup(3291459)
	    if Rank >=7 then  
		spyglass:Clone()
		spyglass.Parent = player.StarterPack
		flintlock:Clone()
		flintlock.Parent = player.StarterPack
		sabre:Clone()
		sabre.Parent = player.StarterPack
	end 
end)

1 answer

✓ Accepted answer

Here is correctly version of your script and place this script in ServerScriptService.

game.Players.PlayerAdded:connect(function(player)
	if player:GetRankInGroup(3291459) >= 7 then  
		local spyglass = game.Lighting.SpyGlass:Clone()
		spyglass.Parent = player.Backpack
		local flintlock = game.Lighting.Flintlock:Clone()
		flintlock.Parent = player.Backpack
		local sabre = game.Lighting.Sabre:Clone()
		sabre.Parent = player.Backpack
	end 
end)

4 comments

0

didn't work, should i change StarterPack to backpack maybe?

0

nope...still doesn't work, if the variables are local would i need to make it a LocalScript?

0

No, do you have put the script in ServerScriptService?

0

Because the script work for me

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