Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Position script not working?

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.