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

Model:MoveTo() isn't moving the model? (Answered)

local module = {}
	function module.new()
		print("Module Fired")
		game.Workspace.Floors.Auto:ClearAllChildren()
		local floors = math.random(10,15)			 
                game.Workspace:FindFirstChild("ServerData").Floors.Value = floors
		nextfloor = 0
		for i = 1,floors do
		wait()
		local random = math.random(1,#game.ServerStorage.Floors.FLOOR:GetChildren())
		local floor = game.ServerStorage.Floors.FLOOR:FindFirstChild(random):Clone()
		if floor then
			nextfloor = nextfloor + floor.Scale.Value
			floor:MoveTo(Vector3.new(75.45,nextfloor,-71.4))
			floor.Parent = game.Workspace.Floors.Auto
		end
		end
	end
return module

^ Here is my script. Basically, i'm trying to remake the game "Tower of Hell". If you've played that, you know floors generate randomly. This script is a module script in serverstorage. What this script is supposed to do is generate random floors, game.ServerStorage.Floors.FLOOR only has 1 child named "1" at the moment. Later there will be more children. (2,3,4,etc.) So, to my problem, everything seems to be working except the :MoveTo(). I've tried multiple tests, all the floors spawned in the same place. Doing :MoveTo() manually (dev console) did move the floors. Am I doing something wrong? Also floor.Scale.Value is there so the floors can have different height. Thank you!

1 answer

I was playing around and found it works if you parent the model to the workspace, then move

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