Hi so I am a starter scripter and im trying to figure out how can you change the position of a part using math.random so basically I have a spawn and I want the position to be randomized for where the players spawn.
Well this all depends on how random you wish to have it.
Do you want it randomized on a set of coordinates? If so then you want:
local randomCoordinates = {{5, 2, 5}, {0, 0, 0}, {242, 242, 2525}, {242,4242, 242}} -- update this table to your desired coordinates local Part = Instance.new('Part') local randomCoordinate = randomCoordinates[math.random(1,#randomCoordinates]) local X, Y, Z = randomCoordinate[1], randomCoordinate[2], randomCoordinate[3] Part.CFrame = CFrame.new(X, Y, Z) Part.Parent = workspace
Do you want it constantly random regardless of where it spawns?
local Part = Instance.new('Part') local X, Y, Z = math.random(1,math.huge), math.random(1,math.huge), math.random(1,math.huge) Part.CFrame = CFrame.new(X, Y, Z) Part.Parent = workspace
Maybe something like this would work??
local Spawn = script.Parent--wherever this part is Spawn.CFrame.X = math.random
This may not work I wasn't able to test it out in studio also this is just a guess to get it to work. Hope this helps!!