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

Give item from ServerStorage if player owns badge?

Asked by 4 years ago
Edited 4 years ago

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.

0
I think you also need to clone the item into the StarterPack or something? Rynappel 212 — 4y

2 answers

Log in to vote
0
Answered by
s_iara 94
4 years ago

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 :/

Ad
Log in to vote
0
Answered by
Rynappel 212 Moderation Voter
4 years ago

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.

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. DiamondRules01 56 — 4y
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 DiamondRules01 56 — 4y

Answer this question