Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

You can make the script alot more simple

1 comment

0

Yeah. I could. Not a helpful answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.