Ad
Log in to vote
0

How can you create an algorithm that places something randomly?

Asked by 1 month ago

Hey, I'm working on a game where there are always two buttons at the bottom that are supposed to have random text on them, but that's another question, the question of this thread is how do I make it so that when I press it at the bottom and it says for example "Ice" and I press it and it first fetches the part from the replicated storage and then places it randomly any where on the map?

1 answer

Log in to vote
0
Answered by 1 month ago

First of all, your supposed to try and make the script yourself. Secondly, don't use replicated storage, their is server storage for a reason. Now I am going to give you the script but next time actually try and do it yourself...

I am guessing you want the player to press a TextButton.

local original = game.ServerStorage.Ice

script.Parent.MouseButton1Down:Connect(function(click)
    local copy = original:Clone()
    copy.Parent = game.Workspace
    copy.Position = Vector3.new(math.random(100),0,math.random(100))
end)

This is a Server Script inside of the TextButton.

This is completely random, if you rather have set spawns but still random go here https://devforum.roblox.com/t/randomizing-position/352863

0
Ay man thanks im trying to learn scripting and did not know fully where to start thats why still thanks. Hallohallo98 2 — 1mo
Ad

Answer this question