#Ending with badge isnt working

1 messages · Page 1 of 1 (latest)

idle plinth
#

So basically what im going after is that theres a trigger part and whenever i walk into that part, 2 meshes named Door1 and Door2 go sideways, so basically Door1 goes 7 studs left and Door2 goes 7 studs right, and once they have opened theres a part where if you touch you get awarded a badge and the player gets kicked from the game and the message says "Congrats on beating the game, this is the first of many steps." basically thats what im going after and i havent added the kick/message yet but ive added everything and ive tried editing it and asking chat gpt and it still doesnt work

#

heres the script

#
local part = game.Workspace.TriggerEnd 
local gateDoor = game.Workspace.GateDoor
local door1 = gateDoor.Door1
local door2 = gateDoor.Door2
local endingPart = gateDoor.endingpart
local badgeID = 6967923259 

local doorsMoved = false


local function moveDoors()
    if not doorsMoved then
        
        door1.CFrame = door1.CFrame * CFrame.new(-7, 0, 0)

        
        door2.CFrame = door2.CFrame * CFrame.new(7, 0, 0)

        
        doorsMoved = true
    end
end


local function awardBadge(player)
    local badgeService = game:GetService("BadgeService")
    local success, error = pcall(function()
        badgeService:AwardBadge(player.UserId, badgeID)
    end)

    if not success then
        warn("Error awarding badge: " .. error)
    end
end


part.Touched:Connect(function(hit)
    local character = hit.Parent
    local player = game:GetService("Players"):GetPlayerFromCharacter(character)

    if player then
        
        moveDoors()
    end
end)

-
endingPart.Touched:Connect(function(hit)
    local character = hit.Parent
    local player = game:GetService("Players"):GetPlayerFromCharacter(character)

    if player then
        
        awardBadge(player)
        print(player.Name .. " has received the badge!")
    end
end)
weak arch
#

Does the door opening or the badge awarding not work?

idle plinth
#

none of them work

#

i enter the trigger, doors dont move, and when i move the doors manually inside of the game, i walk into the ending part and it doesnt give the badge