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

Give item from ServerStorage if player owns badge?

Recently, I've been trying to find a way to make a script that gives the player a item out of the ServerStorage. I've tried my own scripts and they haven't helped. I've even looked on the web and the toolbox. Yet, none work. Does anyone know a script that is currently working?

I need it so the item it kept forever after they are awarded the badge.

Here is the script I used too, I think I might has typed it all wrong but I'm not the best at scripting.

badgeid = 2124479032
location = game.ServerStorage
tool = {"Galaxy Radio"}

game.Players.PlayerAdded:connect(function(p)
  p.CharacterAdded:connect(function(c)
        if game:GetService("BadgeService"):UserHasBadge(p.userId, badgeid) then
        for i,v in pairs(tool) do
              local clone = location:WaitForChild(v):Clone()
              clone.Parent = p.Backpack
            end
        end
  end)
end)

No block touch is active during this as the badge is awarded after staying in the game for an hour.

1 comment

0

I think you also need to clone the item into the StarterPack or something?

2 answers

✓ Accepted answer

This may not work, but hopefully you'll get a gist of what I mean.

badgeid = 2124479032
radiolocation = game.ServerStorage.GalaxyRadio

game.Players.PlayerAdded.connect(function(p)
p.CharacterAdded:connect(function(c)
if game:GetService("BadgeService"):UserHasBadge(p.userId, badgeid)
then for i,v in pairs(tool) 
do local clone = radiolocation:WaitForChild(v):Clone()
clone.Parent = p.Backpack
end

-In your ServerStorage, make sure to change it to GalaxyRadio or something without a space or else line 2 won't work

-And btw this isn't meant to work, I was basically rewriting your script and giving you an idea of what it could look like :/

Please provide a script so we can help you. If there is a block touch function that gives the badge then make it so when you touch the block it will give the tool.

2 comments

0

I've currently only got this. I'm not the best at scripting. And no, the badge is an hour badge which has no block touch involved.

0

badgeid = 2124479032 location = game.ServerStorage tool = {"Galaxy Radio"} game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c) if game:GetService("BadgeService"):UserHasBadge(p.userId, badgeid) then for i,v in pairs(tool) do local clone = location:WaitForChild(v):Clone() clone.Parent = p.Backpack end e

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