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

Why does the map for my game not spawn?

Asked by 6 years ago
Edited 6 years ago

Thanks to the last tip the command is flowing which is good but the map is not spawning. I tried removing wait (10) to see if the wait was too long but the script still does not work.

local x = 81.6
local y = -10.1
local z = -52
local Maps = game.ServerStorage.Maps:GetChildren()
local Choose = Maps[math.random(1, #Maps)]
    -- Map selection
while Resttime do
    local placemap = Choose:Clone()
    placemap.Position = Vector3.new (x, y, z)
    placemap.Parent = game.Workspace

end

I've Now tried changing it to a funtion

    local function Placing()
    local placemap = Choose:Clone()
    placemap.Parent = game.Workspace
    placemap.Position = Maps.position


end

Does the same thing! Nothing!

0
Are the maps models? Position is part of a model.. use placemap:MoveTo(Vector3.new(x,y,z)) Bellyrium 310 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Is the map that is being chosen a model? If so, you're trying to feed it a position that it can't do anything with. You also have no primary part defined.

Set a primary part and use :SetPrimaryPartCFrame

placemap:SetPrimaryPartCFrame(CFrame.new (x, y, z))

Also, make sure you're not using a LocalScript and move the variable "Choose" inside of "while true do", with it being outside of it, it'll only choose a random map once, and it'll keep choosing that exact same map every time it's called.

while Resttime do
    local Choose = Maps[math.random(1, #Maps)]

    local placemap = Choose:Clone()
    placemap:SetPrimaryPartCFrame(CFrame.new (x, y, z))
    placemap.Parent = game.Workspace
end

0
:SetPrimaryPart() will error if there is no primary part assigned. Bellyrium 310 — 6y
Ad

Answer this question