Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make Coins Spawn anywhere in world like a simulator?

i'm trying to make a simulator but the coin is in one place and not randomly spawning or cloning itself. give me examples of scripts to use

2 comments

0

ScriptingHelpers is not a request site. Please make your own scripts, and if they give an error, or if you're not sure how to do them, ask a question. For a similar thing, check these videos out: https://www.youtube.com/watch?v=RoENRFy4ofA&list=PLuEQ5BB-Z1PJ4JIDXpttxuvCzJMeIqzMi&index=16, https://www.youtube.com/watch?v=rsTN0DppMaA&list=PLuEQ5BB-Z1PJ4JIDXpttxuvCzJMeIqzMi&index=17

0

Bro, you need to chill Pokemaster

2 answers

local Coin = game.ServerStorage.Coin --Location of the coin, recommend it be a part, mesh part, or part with mesh
local Delay = 10 --Delay until spawns another
local Y  = 4 --The Y axis you want the coins to spawn in

local Base = game.Workspace.Base --The base/the area you want it to spawn in

local function GetPos()
	local X_Size = Base.Size.X
	local Z_Size = Base.Size.Z

	local Max_X_Pos = Base.Position.X + X_Size
	local Max_Z_Pos = Base.Position.Z + Z_Size

	local Min_X_Pos = Base.Position.X - X_Size
	local Min_Z_Pos = Base.Position.Z - Z_Size

	return math.random(Min_X_Pos, Max_X_Pos), math.random(Min_Z_Pos, Max_Z_Pos)
end

while true do
	local NewCoin = Coin:Clone()
	NewCoin.Parent = game.Workspace
	
	local X,Z = GetPos() --Get workable position
	NewCoin.Position = Vector3.new(X, Y, Z) --If this doesn't work, try CFrame
	
	wait(Delay)
end

I haven't tested it, just came up with it. Hopefully it works!

1 comment

0

thanks ill try it

First try to script it you're self you dont learn if you just copy scripts Ur gonna need The Clone() function and a loop

best of luck

This discussion is preserved as it was. New answers, comments, and votes are closed.