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

Button To Turn AutoCollect Off Not Working, how do i do???

the autocollect: ON button works, but the autocollect: OFF does not. I am using a zednov's tycoon kit but i customized it so that i can autocollect. the snippet from the tycoon core:

--Parts that fall into the collector(s) get processed
	for i,v in pairs(script.Parent.Essentials:GetChildren()) do
		if v.Name == "PartCollector" then
			v.Touched:connect(function(Part)
				local player = script.Parent.Owner.Value
				if Part:FindFirstChild('Cash') then
				if script.Parent.Parent.Parent.AutoCollect.Value == true then
			game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value + Part.Cash.Value
			elseif script.Parent.AutoCollect.Value == false then
					Money.Value = Money.Value + Part.Cash.Value
			end
					Debris:AddItem(Part,0.1)
				end
			end)
		end
	end


the snippet from the GUI(which seems to be working but just putting it in here to be sure):

script.Parent.MouseButton1Click:Connect(function(fart)
	game.Workspace.HafrewsTycoonKit.AutoCollect.Value=false
	script.Parent.Parent.Autocollect.Text=("Autocollect:Off")
end)

please help me, and an advance THANK YOU!!!

4 comments

0

Please put your code into a code block, it makes it a whole lot easier to read! It also helps us to paste your code to test it ingame.

0

ok, i did that

0

i suggest you not take other people's code unless you can understand it, if you do not understand this, then please study these things so you can understand it and fix it yourself, use scripting helpers as a last resort if you cannot find anything or figure it out.

0

also are there any errors? if so please post them

1 answer

✓ Accepted answer

I dont know if this will work, but try making the value false (Add an extra line):

--Parts that fall into the collector(s) get processed
    for i,v in pairs(script.Parent.Essentials:GetChildren()) do
        if v.Name == "PartCollector" then
            v.Touched:connect(function(Part)
                local player = script.Parent.Owner.Value
                if Part:FindFirstChild('Cash') then
                if script.Parent.Parent.Parent.AutoCollect.Value == true then

			script.Parent.Parent.Parent.AutoCollect.Value = false

            game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value + Part.Cash.Value
            elseif script.Parent.AutoCollect.Value == false then
                    Money.Value = Money.Value + Part.Cash.Value
            end
                    Debris:AddItem(Part,0.1)
                end
            end)
        end
    end


6 comments

0

(line 09 is the line i added in)

0

thanks it works

0

please accept my answer since it worked

0

PLEASE, IF IT WORKS ACCEPT MY ANSWER

0

i DID

0

I SAID THAT 9 DAYS AGO, YOU DID NOT ACCEPT MY ANSWER UNTIL 8 DAYS LATER

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