I needed help scripting this certain system in my game.
What is my game:
My game is a game where miniature trees are hidden in a small map, and you have to try to find the trees. Each color differs between points.
So, what I want is the trees would be placed randomly but secretly so the trees are not seen obviously, but not the same location or else people who play it a few times will know the locations of where is the tree is, and the game would be basically no fun after that. I just can’t find a solution on possibly how you make a script hide the tree well and in a safe location behind assets in a certain map. If you do not feel comfortable helping on devforums or anybody who doesn’t have access to DevForums and is just scrolling, feel free to text me on discord.
Discord: xinder#3686
Thank you so much for reading, and I hope to get some support!
Uh, if you need help scripting that, just make it when the tree is touched, the model is destroyed and the player gets +10 points to their leaderstats.
local tree = game:GetService("ServerStorage").Tree
local Debris = game:GetService("Debris")
local duration = [put how many seconds here]
while wait(duration) do
local newTree = tree:clone()
local randX = math.random(-1000,1000)
local randZ = maht.random(-1000,1000)
newTree.Position = = Vector3.new(randX,100,randZ)
newTree.parent = workspace
Debris:AddItem(newTree,20)
end
Wow. That’s insane. But, I do believe it will take some adjustments to put into my game? Because, it might not fit in my map. My map is small, they are mini maps, if you add me on discord, I can send you pics.
Thanks, also, one last question. Does the position matter? I still don’t understand how just that one script will fix the whole problem. It will place under areas that will make players look for trees, and not just spawn in plain sight?
Sorry for being nosy, its just my first solo project.
Depending on how diverse your game is, you could also create preset positions stored in a table for trees to spawn at. Obviously if the map is quite large, alternatives might be more ideal, but I would still consider this one.
e.g:
local positions = {
CFrame.new(0, 5, 0);
CFrame.new(0, 10, 0); --//examples
}
tree:SetPrimaryPartCFrame(positions[math.random(#positions)]) --//Set CFrame of tree model to random
Also, that’s exactly what I am avoiding about! I don’t want preset because the map is small, also, even if it was big, that would be easily memorizable.