How would I go about making a randomized spawn object

Hello! i was wondering how I can make these object have different spawn locations but only limit to for example: 7 that could spawn.

I was thinking of how I can make the proximity prompt be one so I wouldn’t have to go back and change it everytime for each object

Lastly, is there a possible way to rotate/move/tween them locally with just 1 script?

(I would also want for these to be in server side, thank you!)

image

This is the script that is inside the proxmity prompt:

script.Parent.Triggered:Connect(function()
	script.Parent.Parent.Transparency = 1
	script.Parent.Enabled = false
	game.ReplicatedStorage.Collected.Value += 1
end)

This is the script that is inside the collection Gui:

local collectionName = "Collected"

script.Parent.Text = game.ReplicatedStorage.Collected.Value.."/"..#workspace.Collections:GetChildren().." "..collectionName

game.ReplicatedStorage.Collected.Changed:Connect(function()
	script.Parent.Text = game.ReplicatedStorage.Collected.Value.."/"..#workspace.Collections:GetChildren().." "..collectionName
	
	if game.ReplicatedStorage.Collected.Value == #workspace.Collections:GetChildren() then
		-- do stuff
	end
end)

Things in explorer if you need:
image

I know these are a lot of request but I’m still learning, thank you so much for helping.

So your request is how can you spawn them in a random positions? Oh nevermind

Somewhat like that, I would like to place multiple object but have them limit to a certain amount of object to spawn in different places

So you want to spawn a certain amount of objects in random positions

Yes

that’s what I mean.

(characters)

something like that

function spawn() 
    local part = Instance.new("Part") -- just clone in your case
    part.Parent = workspace
    part.Position = Vector3.new(math.random(-100,100),5,math.random(-100,100)) -- change the y value 5 
end

for i = 1, amount, 1 do
    spawn()
end

this is just the idea maybe you can use this for your case