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

Position script not working?

Asked by
iLordy 27
8 years ago

Im trying to make a model called "Monster" go to a different position using vector3 when a certin block is touched. ~~~~~~~~~~~~~~~~~ script.Parent.Touched:connect (function() game.Workspace.Monster.Position = Vector3.new(2, 3, 0) -- Wherever you want end)

~~~~~~~~~~~~~~~~~ however i dont know why its not working and the output menu says Position is not a valid member of Model.

2 answers

Log in to vote
0
Answered by 8 years ago

Models do not have a property called "Position". Only parts and guis etc have that.

To move a model you need to use the :MoveTo() method.

To move your model to 2,3,0 you will need to write:

script.Parent.Touched:connect (function() 
    game.Workspace.Monster:MoveTo(Vector3.new(2,3,0))
end)

You might need to set the primary part of the model (change this in properties) to get it to move to the right place, otherwise the code will pick a random part of the model and use that; which might make your model stick through the floor etc.

Note that MoveTo() requires a Vector3.new(x,y,z) inside the brackets. MoveTo(2,3,0) will not work.

MD

Ad
Log in to vote
0
Answered by 8 years ago
d = false
script.Parent.Touched:connect(function(Hit)
    if Hit.Parent:FindFirstChild("Humanoid") then
        d = true
        wait(2)
        d = false
    end
end)

You don't want a brick to touch it and have a monster to appear.

You also want a debounce so the monster doesn't appear 80 times when a player touches the part.

Tee Hee

Answer this question