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

[SOLVED] How do I change the position of entire models from the ServerStorage?

Asked by 5 years ago
Edited 4 years ago
function onClicked(player)
    if player.Name == "Brad_xv" then --If I press the button then,
        local crateSpawn = game:GetService("ServerStorage").Challenges.Challenge1.Crate:clone()
        crateSpawn.Parent = game.Workspace --Add to the workspace.
        crateSpawn.Position = script.Parent.Parent.CrateSpawn.Position --Change the position of the clone to "CrateSpawn".
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Error is on Line 5, I'm not sure how else it could be done though ("Position is not a valid member of Model").

1 answer

Log in to vote
0
Answered by 5 years ago

Nevermind. Just solved it by replacing the .Position to a :MoveTo(), stupid mistake!

function onClicked(player)
    if player.Name == "Brad_xv" then --If I press the button then,
        local crateSpawn = game:GetService("ServerStorage").Challenges.Challenge1.Crate:clone()
        crateSpawn.Parent = workspace
        crateSpawn:MoveTo(script.Parent.Parent.CrateSpawn.Position) --Changes position of the group.
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Ad

Answer this question