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

Cash to Collect button Not claiming cash?

Asked by 4 years ago

Hey there, I have an issue with my cash to collect button. There is not errors.

Here is the script:

while wait(.3) do
    script.Parent.BillboardGui.TextLabel.Text = "Cash to collect : $"..tostring(script.Parent.Parent.Parent.CashToCollect.Value)
end

script.Parent.Touched:Connect(function(Hit)
    local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
    if Player then
        local Human = Hit.Parent:FindFirstChild("Humanoid")
        if Human then
            if Hit.Parent.Humanoid.Health >= 1 then
                if Player and Player == script.Parent.Parent.Parent.Owner.Value then
                    local Money = script.Parent.Parent.Parent.Owner.Value:FindFirstChild("leaderstats"):FindFirstChild("Cash")
                    if Money then
                        Money.Value = Money.Value + script.Parent.Parent.Parent.CashToCollect.Value
                        script.Parent.Parent.Parent.CashToCollect.Value = 0
                    end
                end 
            end
        end
    end
end)
0
Because your loop is holding the thread. Ziffixture 6913 — 4y
0
Ok. NillaTheCat12345 14 — 4y

Answer this question