Math.Random giving more than it's supposed to

sorry, was doing something, will test!

No, though there is a script that the gen part connects to.

function gen()
	local SS = game:GetService("ServerStorage")
	local part = SS.CoinsWRLD1.Coin:Clone()
	part.Parent = workspace
	local x = math.random(130,366) 
	local z = math.random(-156,162) 
	part.Position = Vector3.new(x,1.5,z)
end

for _= 1,50 do
	gen() wait(0.1)
end

Its in ServerScriptService though

Edit: also this whole code that we have been talking about is in ServerStorage

Did not work, and this time some of the coins wouldn’t even be deleted

Still gives more than the math.random ):

Put this in the coin in ServerStorage that you are cloning:

local ServerStorage = game:GetService("ServerStorage")

local db = false
local waitTime = 5

local function gen()
	local part = ServerStorage.CoinsWRLD1.Coin:Clone()
	part.Position = Vector3.new(math.random(130,366), 1.5, math.random(-156,162))
	part.Parent = workspace
end

script.Parent.Touched:Connect(function(hit)
	if not db then
		db = true
		local Player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		if Player then
			local amnt = math.random(5,20)
			Player.leaderstats.Coins.Value += amnt
			gen()
			script.Parent:Destroy()
		end
		wait(0.5)
		db = false
	end
end)

That’s so weird. It works for my side so I don’t know what could be happening.

1 Like

Yeah honestly I have no idea. Everything was perfectly fine before…