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

Impossible GUI to create?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I've been trying my best to make a GUI with weapon equip options. However, the weapons in the game must be found via Badge collection. So once the badge for the weapon is found, you should be able to click on the GUI button and equip it to the players inventory, if it isn't found then the equip button should be disabled. I'm confident I'm just following the wrong guidelines to make it, any options for this?

My sad attempt ~

01ID = 158694379
02badge = game:GetService("BadgeService")
03player = script.Parent.Parent.Parent.Parent.Parent
04 
05function find(userid, badgeid)
06if game:GetService("BadgeService"):UserHasBadge(userid, badgeid) then
07    clone = game.Lighting.GravityCoil:clone()
08    clone.Parent = player.StarterGear
09    end
10end
11 
12function MouseClick(hit)
13    if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
14        local p = game.Players:GetPlayerFromCharacter(hit.Parent)
15        if (p ~= nil) then
View all 23 lines...

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

Sorry if you've moved on or already solved this problem. It's sometimes difficult to find older questions that have no answers.

Your MouseClick code is doing a few things wrong. hit is always nil, since MouseButton1Click doesn't pass in any arguments. You're expecting find to return something, when you have no return statements in the find code, and you're not actually putting the tool in their BackPack, just their StarterGear. Twice. 'badgeholder' is not defined in this code. I assume you meant to use ID? Finally, you are missing a lot of ends.

01ID = 158694379
02badge = game:GetService("BadgeService")
03player = script.Parent.Parent.Parent.Parent.Parent
04 
05function MouseClick()
06    if game:GetService("BadgeService"):UserHasBadge(player.userId, ID) then
07        clone = game.Lighting.GravityCoil:clone()
08        clone.Parent = player.StarterGear
09        clone = clone:Clone()
10        clone.Parent = player.BackPack
11    end
12end
13script.Parent.MouseButton1Click:connect(MouseClick)
Ad

Answer this question