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

Getting a coin... it isn't working?

Asked by 9 years ago

My script:

player = game.Players.LocalPlayer

got = {}
print("SET UP GOT TABLE")
    script.Parent.Touched:connect(function(part)
        if part.Parent.findFirstChild("Humanoid") ~= nil then
            print("HUMANOID TOUCHED IT")
            local c = 0
            for key, value in pairs(got) do
                print("CHECKING FOR ALREADY GOT")
                if value ~= player then
                    c = c + 1
                    if c == #got then
                        print("DOESNT HAVE")
                        _G.Coins = _G.Coins + 1
                        part.Parent.Torso.CFrame = CFrame.new(Vector3.new(-16.1, 3, -219))
                        got[1] = player
                        print("GAVE PLAYER COIN!")
                    end
                end
            wait()
            end
            print("ENDING PLAYER CHECK")
        end
        print("ENDING SCRIPT!")
    end)

You should get the coin, it tp's you away, then prevents you from getting it again.

Why isn't it working?

1 answer

Log in to vote
-1
Answered by 9 years ago

You can make the script alot more simple

0
Yeah. I could. Not a helpful answer. User#5565 45 — 9y
Ad

Answer this question