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

How do i make it so only players who join a specific group can purchase this item?

Asked by 3 years ago

Im making a simulator and i want to make a backpack that only people who join my group can buy. But this script im using directly puts it on the player. I want it so players have to buy it in the shop but only people in the group can buy it. Does anyone know how i can do this?

local groupId = 3123903

local backpack = game.ServerStorage.GroupBackpack

function onPlayerSpawned(player)
  if player:IsInGroup(groupId) then
    backpack:Clone().Parent = player.Character
  end
end

game.Players.PlayerAdded:connect(function(player)
  player.CharacterAdded:connect(function()
    onPlayerSpawned(player)
  end)
end)
0
use `Connect` instead of `connect`, the latter one has been deprecated and use GetService for the services VerdommeMan 1479 — 3y
0
Make a shop, use the :IsInGroup() boolean as a debounce. Ziffixture 6913 — 3y

Answer this question