Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Giving tools to certain ranks?

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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)
0
didn't work, should i change StarterPack to backpack maybe? XGodofGods -2 — 6y
0
nope...still doesn't work, if the variables are local would i need to make it a LocalScript? XGodofGods -2 — 6y
0
No, do you have put the script in ServerScriptService? NiniBlackJackQc 1562 — 6y
0
Because the script work for me NiniBlackJackQc 1562 — 6y
Ad

Answer this question