Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Item location Randomizer not working?

Asked by 8 years ago

Idea The idea of this script is to get the object Statue and move it to a location within the specified area.
Problem The problem is that I get the error MoveTo is not a valid member of Part
Code:

local model = game.Workspace.Treasure2.Statue
local minTime = 1
local maxTime = 1 
local xPos = {-6.5, 28.5}
local yPos = {0.5, 0.5}
local zPos = {-22.5, 2.5}

while wait(math.random(minTime, maxTime)) do
local m = model:Clone()
local x = math.random(xPos[1], xPos[2])
local y = math.random(yPos[1], yPos[2])
local z = math.random(zPos[1], zPos[2])
m:MoveTo(Vector3.new(x,y,z))
end

2 answers

Log in to vote
1
Answered by 8 years ago
local model = game.Workspace.Treasure2.Statue
local minTime = 1
local maxTime = 1
local xPos = {-6.5, 28.5}
local yPos = {0.5, 0.5}
local zPos = {-22.5, 2.5}

while wait(math.random(minTime, maxTime)) do
local m = model:Clone()
local x = math.random(xPos[1], xPos[2])
local y = math.random(yPos[1], yPos[2])
local z = math.random(zPos[1], zPos[2])
m.Parent = game.workspace
m.Position = Vector3.new(x,y,z)
end

1) It's m.Poistion

2) For some reason, I have to make the clones parent workspace, or it doesn't work.

0
I was first User#5978 25 — 8y
0
You didn't answer the question fully nor did you supply a "fixed" script User#6200 10 — 8y
0
True, sorry hard to type on iPhone so I try to make my answers elaborate and quick User#5978 25 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

From what I can see you need to do move to for the model not the part. So do m.Parent:MoveTo

0
its not in a model pluginfactory 463 — 8y
0
MoveTo isn't in parts only in models so try m.Position = Vector3.new(x,y,z) User#5978 25 — 8y
0
Thumbs up if this is right :) User#5978 25 — 8y

Answer this question