I am trying to figure out a way to move my fish object in a specific area randomly. Is there an easy way to do so? If you have any ideas please share. Thanks, I also tried this script, but it gives me this error: attempt to call global 'Vector3' (a table value)
Script here:
fish = script.Parent X = math.Random(10) Y = math.Random(10) Z = math.Random(10) while wait(0.5) do fish.CFrame = fish.CFrame + Vector3(X, Y, Z) end
The function is spelt random
, not Random
.
Vector3
is a table, while .new()
is a function inside it.
local fish = script.Parent local x = math.random(1, 10) local y = x local z = y while wait(.5) do fish.CFrame = fish.CFrame + Vector3.new(x, y, z) end