Attempt to call a table value when trying to randomize a position

I’m trying to get an object to go to a random position.

The script:

	ss.Position = Vector3(math.random(0,1000), 150, math.random(0,1000))

The error:

  09:16:46.148  ServerScriptService.StormSystemMain.StormComponents:6: attempt to call a table value  -  Server - StormComponents:6
  09:16:46.148  Stack Begin  -  Studio
  09:16:46.148  Script 'ServerScriptService.StormSystemMain.StormComponents', Line 6 - function SpawnStorm  -  Studio - StormComponents:6
  09:16:46.149  Script 'ServerScriptService.StormSystemMain.StormComponents', Line 32 - function IssueStorm  -  Studio - StormComponents:32
  09:16:46.149  Script 'ServerScriptService.StormSystemMain', Line 14  -  Studio - StormSystemMain:14
  09:16:46.149  Stack End  -  Studio

Apologies for the lack of clarification, I don’t want people stealing my script.

Uh? well show the part where its causing the error.
what is your ss variable type?

local ss = game:GetService("ReplicatedStorage"):WaitForChild("StormObjects"):WaitForChild("StormSpawn"):Clone()

It’s a part.

You forgot to add .new at the end of vector3:

ss.position = Vector3.new(math.random(0,1000), 150, math.random(0,1000))

1 Like
so.Size = Vector3.new(math.random(Min*10,Max*10), 15, math.random(Min*10,Max*10))

so is a cloned part.

The new error:

  10:24:53.606  ServerScriptService.StormSystemMain.StormComponents:16: invalid argument #2 to 'random' (interval is empty)  -  Server - StormComponents:16
  10:24:53.606  Stack Begin  -  Studio
  10:24:53.606  Script 'ServerScriptService.StormSystemMain.StormComponents', Line 16 - function SpawnStorm  -  Studio - StormComponents:16
  10:24:53.606  Script 'ServerScriptService.StormSystemMain.StormComponents', Line 32 - function IssueStorm  -  Studio - StormComponents:32
  10:24:53.606  Script 'ServerScriptService.StormSystemMain', Line 14  -  Studio - StormSystemMain:14
  10:24:53.607  Stack End  -  Studio

Is the max value smaller than the min value? Try printing min and max and tell me their values