Ad
Log in to vote
0

Issue with awarding a badge to player who touches part?

Asked by 9 days ago
Edited 9 days ago

Hello! I've been having a little bit of issue with my game. I wanted to make it so when a player touches a certain part, it awards the player a badge and comes up with a GUI. I did it once and it worked, however after I added lines 7, 10, 11, and 12, it stopped working. If anyone could help I would really appreciate that and I am willing to post any additional information if needed. Thanks!

local badgeService = game:GetService("BadgeService")
local id = "2127702459"
local brickynicky = script.Parent

local function doThingy(otherPart)
    local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
    local gui = game.StarterGui.GUI.Frame
    if otherPart.Parent:FindFirstChildWhichIsA("Humanoid") then
        badgeService:AwardBadge(player.UserId, id)
        gui = true
        wait(3)
        gui = false
    end
end

brickynicky.Touched:Connect(doThingy)

1 answer

Log in to vote
0
Answered by 9 days ago

I think you mean gui.visible = true Fixed Code:

local badgeService = game:GetService("BadgeService")
local id = "2127702459"
local brickynicky = script.Parent

local function doThingy(otherPart)
    local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
    local gui = game.StarterGui.GUI.Frame
    if otherPart.Parent:FindFirstChildWhichIsA("Humanoid") then
        badgeService:AwardBadge(player.UserId, id)
        gui.Visible = true
        wait(3)
        gui.Visible = false
    end
end

brickynicky.Touched:Connect(doThingy)
Ad

Answer this question