#why doesnt it work??

1 messages · Page 1 of 1 (latest)

south copper
#

ive spent 1 hour but idk bro

local tool = script.Parent
local sound = Instance.new("Sound")
local isActive = false
local player = game.Workspace:WaitForChild("bgoku0710")
local luckLabel = player.PlayerGui.ScreenGui.luck
local clover = game.Workspace.clover
local cloverTouched = false

local luckBuffs = {}

local function updateLuck()
    local total = 0
    for _, value in pairs(luckBuffs) do
        total = total + value
    end
    luckLabel.Text = "Luck: " .. total
end

local function addLuck(name, value)
    luckBuffs[name] = value
    updateLuck()
end

local function removeLuck(name)
    luckBuffs[name] = nil
    updateLuck()
end

tool.Equipped:Connect(function()
    isActive = true
    sound.Parent = script.Parent
    sound.SoundId = "rbxassetid://81733232182014"
    sound:Play()
end)

tool.Unequipped:Connect(function()
    isActive = false
    sound.Parent = script.Parent
    sound.SoundId = "rbxassetid://6653567310"
    sound:Play()
    removeLuck("gear")
end)

if clover then
    clover.Touched:Connect(function(otherPart)
        if not cloverTouched then
            cloverTouched = true
            game.Debris:AddItem(clover, 0.1)
            addLuck("clover", 0.5)
        end
    end)
end
finite dragon
#

when you do game.workspace:waitforchild(name) that doesnt get the player, it gets the character. If you want to access the playergui, which is a child of player, you need to use Players:GetPlayerFromCharacter()

#

heres the related doc

#

@south copper

south copper
#

didnt work

viral crowBOT
#

studio** You are now Level 1! **studio