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:
01 | --Parts that fall into the collector(s) get processed |
02 | for i,v in pairs (script.Parent.Essentials:GetChildren()) do |
03 | if v.Name = = "PartCollector" then |
04 | v.Touched:connect( function (Part) |
05 | local player = script.Parent.Owner.Value |
06 | if Part:FindFirstChild( 'Cash' ) then |
07 | if script.Parent.Parent.Parent.AutoCollect.Value = = true then |
08 | game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value + Part.Cash.Value |
09 | elseif script.Parent.AutoCollect.Value = = false then |
10 | Money.Value = Money.Value + Part.Cash.Value |
11 | end |
12 | Debris:AddItem(Part, 0.1 ) |
13 | end |
14 | end ) |
15 | end |
16 | end |
the snippet from the GUI(which seems to be working but just putting it in here to be sure):
1 | script.Parent.MouseButton 1 Click:Connect( function (fart) |
2 | game.Workspace.HafrewsTycoonKit.AutoCollect.Value = false |
3 | script.Parent.Parent.Autocollect.Text = ( "Autocollect:Off" ) |
4 | end ) |
please help me, and an advance THANK YOU!!!
I dont know if this will work, but try making the value false (Add an extra line):
01 | --Parts that fall into the collector(s) get processed |
02 | for i,v in pairs (script.Parent.Essentials:GetChildren()) do |
03 | if v.Name = = "PartCollector" then |
04 | v.Touched:connect( function (Part) |
05 | local player = script.Parent.Owner.Value |
06 | if Part:FindFirstChild( 'Cash' ) then |
07 | if script.Parent.Parent.Parent.AutoCollect.Value = = true then |
08 |
09 | script.Parent.Parent.Parent.AutoCollect.Value = false |
10 |
11 | game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name).Value + Part.Cash.Value |
12 | elseif script.Parent.AutoCollect.Value = = false then |
13 | Money.Value = Money.Value + Part.Cash.Value |
14 | end |
15 | Debris:AddItem(Part, 0.1 ) |
16 | end |
17 | end ) |
18 | end |
19 | end |