Here's the script:

local part = script.Parent
local db = true
local model = game.Lighting.Model:GetChildren()

function gum(hit)
	if hit then
		
			
			db = false
			
			if hit.leaderstats.Money.Value >= 5 then
				
				hit.leaderstats.Money.Value = hit.leaderstats.Money.Value - 5
				
			
			
			game.Workspace.tune:Play()
			wait(2)
			local ball = model[math.random(1,#model)]
			ball:Clone().Parent = game.Workspace
			ball.Position = Vector3.new(31,12,-6)
			ball.Anchored = false
			
			db = true
			
			else
				print("You need more money!")
				
				
			end
		end
	end


part.ClickDetector.MouseClick:connect(gum)

Everything works, except for the fact that the balls sometimes STAY in the baseplate, instead of moving to the vector. And other times they go to the right place. Any ideas? All help is appreciated!

1 comment

0

You should not use Lighting to store models, use server storage or replicated storage depending upon your needs.