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

How To Set The Position Of A Model?

Asked by
tanzane 100
10 years ago

Ok, so, let me get things straight...

         F = game.ServerStorage.BathTub:Clone()
        F.Parent = game.Workspace
game.ServerStorage.BathTub:SetPrimaryPartCFrame(game.workspace.MapSpawn.Position + CFrame.new(0,0,0))

I'm trying to get my model - also known as Bath Tub - to first off, spawn then after I want it to be the child of workspace and finally go to the position MapSpawn. This all works out until it goes to teleporting to MapSpawn. It glitches out and messes up, unfortuantly. The Primary Part name is 'Water' if you wanted/needed to know. For more information, look over the entire code... ;)

S = script.Parent
    W = game.Workspace
        P = game.Players
            Mins = 5
                Seconds = 30
X = game.workspace.Timer

wait(5)

if game.Players.NumPlayers  <= 2 then
    S = Instance.new("Hint", workspace)
        S.Text = "Game will begin soon"
            wait(3)
                S.Text = "Intermission"
repeat 
    X.Value = X.Value - 1
    wait(1) 
        S.Text = "Intermission:" .. X.Value 
until X.Value == 0
    wait(.5)
         F = game.ServerStorage.BathTub:Clone()
        F.Parent = game.Workspace
game.ServerStorage.BathTub:SetPrimaryPartCFrame(game.workspace.MapSpawn.Position + CFrame.new(0,0,0)) -- This is the Error


        S.Text = "Starting now..."
            wait(3)
                S:Destroy()
local function Teleport()
    game.Players.LocalPlayer.Character:MoveTo(game.workspace.Tele.Position + Vector3.new(0,5,0)) end

Teleport()
    elseif game.Players.NumPlayers <= 1 then
    H = Instance.new("Hint", workspace)     
        H.Text = "Game requires two people to play"
wait(2)         
            H.Text = "Wait for more"
    wait(2)     
                H.Text = "I bet you're just like" 
wait(1)
    H:Destroy()
                wait(1)

                game.workspace.NoTime:Play()
wait(5)             
                if game.Players.NumPlayers >= 2 then
                    game.ServerStorage.NoTime:Stop()
                end
end

Fyi - This is all in a 'Local' script!

1 answer

Log in to vote
1
Answered by
Dominical 215 Moderation Voter
10 years ago

To set the position of a model you would use the function MoveTo(vector3)

Example:

local model=game.Workspace.Model
model:MoveTo(Vector3.new(0,2,0))

This will move the model to the given Vector3 Position

Read more on the MoveTo Function Here!

0
Even though you had some problems in your script. (Ex: Not in workspace, in serverstorage.) Thanks!! tanzane 100 — 10y
0
I was just using that as an example LOL Dominical 215 — 10y
Ad

Answer this question