Chronicalr :
let's say you have the card n' key in workspace:
1 | local card = workspace.card |
2 | local key = workspace.key |
so, we now need to move the MODEL , not the tool object.let's say you put it all in the handle block.
1 | local random 1 = Random.new() |
2 | local place 1 = vector 3. new(random 1. NextNumber(mapxlength/ 2 ,mapxlength/ 2 ), 200 ,random 1. NextNumber( |
3 | -mapxlength/ 2 ,mapxlength/ 2 )) |
4 | local random 2 = Random.new() |
5 | local place 2 = vector 3. new(random 2. NextNumber(mapylength/ 2 ,mapylength/ 2 ) 200 ,,random 2. NextNumber( |
6 | -mapylength/ 2 ,mapylength/ 2 )) |
7 | card.handle.position = place 1 |
8 | key.handle.position = place 2 |
put that all in a function to call it any time.(in this case a round)
also, if the card is in weird unintended spots, try intending some spots for the card & key to spawn, use random to pick which spot will it spawn at.
this is the full script:
01 | local card = workspace.card |
02 | local key = workspace.key |
04 | local random 1 = Random.new() |
05 | local place 1 = vector 3. new(random 1. NextNumber(mapxlength/ 2 ,mapxlength/ 2 ), 200 ,random 1. NextNumber( |
06 | -mapxlength/ 2 ,mapxlength/ 2 )) |
07 | local random 2 = Random.new() |
08 | local place 2 = vector 3. new(random 2. NextNumber(mapylength/ 2 ,mapylength/ 2 ) 200 ,,random 2. NextNumber( |
09 | -mapylength/ 2 ,mapylength/ 2 )) |
10 | card.handle.position = place 1 |
11 | key.handle.position = place 2 |
if you need to use the card or key and deplete it: clone it ,set its parent to workspace every round BEFORE you call the function.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
how to use random
03 | < Global namespace | Roblox namespace |
05 | Random is a datatype used to generate pseudorandom numbers using an dedicated internal state. |
16 | Random.new(double seed) |
19 | Creates a new Random object from the given seed. If a seed isn’t specified, one will automatically be pulled from an internal entropy source. |
23 | number Random:NextNumber(number min = 0 , number max = 1 ) |
26 | Returns a pseudorandom number uniformly distributed over [ min, max). |
29 | int Random:NextInteger(int min, int max) |
32 | Returns a pseudorandom integer uniformly distributed over [ min, max). |
38 | Returns a new Random object with the same state as the original. |
~super