Help the scripts dont work for the Robbable bank

I do not know what to do now nothing helped :confused:

Hi, I repaired your scripts. Try it and tell us what happens

--- MoneyGiver script
----------------------

local PlayerFound
-- local Debounce = false

function CreateRegion3FromPart (Part)
	return Region3.new(Part.Position - Part.Size/2, Part.Position + Part.Size/2)
end

function GetPlayersInPart (somePart)
	local region = CreateRegion3FromPart(somePart)
	local partsInRegion = workspace:FindPartsInRegion3(region, nil, math.huge)
	local players = {}
	
	PlayerFound = false
	for _, part in pairs(partsInRegion) do
		local player = part.Parent and game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			for _, plyr in ipairs(players) do
				if plyr.Name == player.Name then
					PlayerFound = true
					break
				end
			end
			
			if PlayerFound == false then
				table.insert(players, player)
			end
			PlayerFound = false
		end
	end
	
	for _, player in ipairs(players) do
		if player.Robbing.Value == false then
			--game.ReplicatedStorage.ShowMoneyGui:FireClient(player)
			player.Robbing.Value = true
		end
		if player.CashCollected.Value < 5000 then
			player.CashCollected.Value = player.CashCollected.Value + 100
		end
	end
	
	return players
end

while true do
	wait(0.5)
	GetPlayersInPart(workspace.BankDetector)
end


-- Script in part
------------------

local debounce = false
script.Parent.Touched:Connect(function (hit)
	if not debounce and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		debounce = true
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player.Robbing.Value == true then
			--game.ReplicatedStorage.HideMoneyGui:FireClient(player)
			player.leaderstats.Money.Value = player.leaderstats.Money.Value + player.CashCollected.Value
			
			player.CashCollected.Value = 0
			player.Robbing.Value = false
		end
		debounce = false
	end
end)


--- LeaderBoardForBank script
-----------------------------

game.Players.PlayerAdded:Connect(function (player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local money = Instance.new("NumberValue")
	money.Name = "Money"
	money.Value = 0
	money.Parent = leaderstats
	
	local cashCollected = Instance.new("IntValue")
	cashCollected.Name = "CashCollected"
	cashCollected.Parent = player
	
	local robbing = Instance.new("BoolValue")
	robbing.Name = "Robbing"
	robbing.Value = false
	robbing.Parent = player
	
	player.CharacterAdded:Connect(function (character)
		robbing.Value = false
		cashCollected.Value = 0
	end)
end)

1 Like

Wow I appreciate your work should I delete all my script and write this ?

yes. at least these three scripts

Nothing worked just errors the Gui doesnt show up I did script where the Gui should appear whenn I rob but it doesnt appear :frowning:

so what should I do I watched Noobie on youtube I did his tutorial 2 times I did AlvinBlox 2 times but it didnt work :confused: :confused: :frowning:

Would you like me to friend you and I wil invite in the studio and then we can talk there and you will show me.

ok but with another account. my name is Ainslie61

Ok I will add now ! Thank you !

Done I added you now I will add you on studio :DDDD

I suggest you change the title.
If someone has the same problem as you, they won’t be able to see this topic… because it’s called “Help with scripts please”.

1 Like

ok but do you know how to do ?

You click the pencil on the post.

No I meant the script of the robbable bank

Is CashCollected an IntValue?

If so this should be player.CashCollected.Value = 0 not that, that just sets the reference as 0 not the value of the intvalue

Ok thank you now it works but the gui doesnt come up and I cant see how much money I will get I will show the script that i did at the gui.

If your current issue got solved you should make a new thread asking about your other question.

1 Like

Ok so when I m going to rob the bank the gui comes up but then it doesnt increase the amount of cash i would get can you help with that please. Btw sorry I m just a begginer I dont know a lot yet.

Is there any errors, if so show me them.

Also on a sidenote how did you make this if your a begginer?

I copied Noobie from youtube.
And I ll show errors