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

How would I spawn a Map Model to specific position in this code?

Asked by
BryanFehr 133
5 years ago

Hello all! My minigame system is seeming to fail atm, and I am entirely sure as to why!

I'd like my script to be able to spawn where the "DungeonSpawn" model with the child part named "Pos" is!

When I run this, after the period of 60 seconds (intermission), it spawns the map, BUT, it spawns it at position (0,0,0) in the workspace! I done some research on the DevForums about this problem, and only found my attempt, which didn't work, so I've turned to here!

Here is my ServerScript located in the workspace! Any and all help is appreciated! Main focus of attention I BELIEVE is Lines 34-43, but I could be wrong! Thank you!

001local minigameModule = {
002    gameRunning = false,
003    playersAlive = {},
004    currentMap = nil
005}
006 
007local waitForChild = game.WaitForChild
008local findFirstChild = game.FindFirstChild
009 
010-- Modules
011 
012local settingsModule = require(waitForChild(script, "Settings"))
013local onWin = (function()
014    local onWinModule = findFirstChild(script, "OnWin")
015 
View all 203 lines...

1 answer

Log in to vote
1
Answered by
Benbebop 1049 Moderation Voter
5 years ago
Edited 5 years ago

You need to use a CFrame I believe,

1chosenMap.PrimaryPart.Position = Vector3.new(game.Workspace.DungeonSpawner.Pos.Position)

should be

1chosenMap.PrimaryPart.Position = CFrame.new(Vector3.new(game.Workspace.DungeonSpawner.Pos.Position))

and you could also do

1chosenMap.PrimaryPart.Position = CFrame.new(game.Workspace.DungeonSpawner.Pos.Position)
Ad

Answer this question