So I have a part of the script, and apparently it won't work when I step on the giver. Also, yes, I have the money value in ServerStorage, with a :GetPropertyChangedSignal function so that when the money changes, the leaderboard cash changes. Any help? Thanks

local deb = false

Spawn.BrickColor = BrickColor.new(teamcolor)
Spawn.TeamColor = BrickColor.new(teamcolor)

script.Parent.Essentials.PartCollector.Touched:Connect(function(hit)
	if hit:FindFirstChild("Money") then
		script.Parent.Money.Value = script.Parent.Money.Value + hit.Money.Value
		hit:Destroy()
	end
end)

script.Parent.Essentials.Giver.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		if hit.Parent:FindFirstChild("Humanoid") then
			if hit.Parent.Humanoid.Health > 0 then
				if script.Parent.Owner.Value == player then
					local money = game.ServerStorage.PlayerStats:FindFirstChild(player.Name)
					if money then
						if deb == false then
							deb = true
							money.Value = money.Value + script.Parent.Money.Value
							script.Parent.Money.Value = 0
							wait(1)
							deb = false
						end
					end
				end
			end
		end
	end
end)

2 comments

0

Does it give an error or simply just not work?

0

It just doesn't work