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

Script Only Works Once After Hay Transparency == 0 (Line 18) Would You Please Help Me?

Asked by 5 years ago

I would like this script to work every time its touched, but it doesn't seem to. It only seems to work until Hay.Transparency == 0 on line 18. Please help me, thanks!

moneyToGive = -25
debounce = false
script.Parent.Touched:connect(function(hit)
    if debounce == true then return end
    player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player == nil then return end
    stat = player:findFirstChild("leaderstats")
    if stat == nil then return end
    cash = stat:findFirstChild("Cash")
    if cash == nil then return end
    debounce = true
    if cash.Value < 0 then
        script.Sound2:Play()
        wait(2) print "line 14"
        debounce = false --Forgot to disable debounce here
    end
    if cash.Value >= 0 then
        if game.Workspace.Desperado.Body.Hay.Transparency == 0 then
            script.Sound2LPlay()
            return end
    end
    if game.Workspace.Desperado.Body.Hay.Transparency == 1 then
        cash.Value = cash.Value + moneyToGive
        game.Workspace.Desperado.Body.Hay.Transparency = 0
        print "Line 20"
        script.Sound:Play()
        game.Workspace.Desperado.Body.Cash20l.BillboardGui.Enabled = true
        wait(3.5)
        game.Workspace.Desperado.Body.Cash20l.BillboardGui.Enabled = false
        wait(2)
        debounce = false
    end
end)
0
Free model isn't it? If you coded this yourself you'd know why. User#19524 175 — 5y
0
If he's modifying a free model, he could benefit from it. That's how I began to learn, incapaz. EzraNehemiah_TF2 3552 — 5y
0
me too, however OP shouldn't post free models if so. User#19524 175 — 5y
0
All my scripts are made by me, with the only exception of the help I have aquired from this website. Anway, so would someone please help or not. Darkcraft10 20 — 5y
0
Btw this is probably to specific to find a free model for. Darkcraft10 20 — 5y

Answer this question