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

how would i move a bunch of models when a part is touched? [closed]

Asked by 6 years ago

so what i need help with is how would i move a bunch of models when touched you see i have a bunch of jump scare model popups spread out over my maze and what i want is when i touch this certain part the models go down into place thus making my game harder then after 5 minutes they can go back up i dont know if i would use wielding or setprimarypart if i do have to use those how do i use them

0
script pls User#23365 30 — 6y

Closed as Not Constructive by RubenKan

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

REMEMBER TO GO TO THE MODEL AND SET ITS PRIMARY PART AS A PART OR THIS WILL ERROR

Define model and part and change position

local model = workspace.Model
local part = workspace.Part
local position = Vector3.new(10,10,10)
part.Touched:Connect(function()
    print('Part touched, moving model')
    model:SetPrimaryPartCFrame(CFrame.new(position))
    print('model moved')
end)

Basically the model is the item being moved the part is the part being touched the position is where the model will move to

Later when the part is touched, the model moves to the desired location

To move it back to its original spot, just change "position" and add wait with a debounce

local model = workspace.Model
local part = workspace.Part
local position = Vector3.new(10,10,10)
local deb = true
part.Touched:Connect(function()
    if deb == true then
        deb = false
        print('Part touched, moving model')
        model:SetPrimaryPartCFrame(CFrame.new(position))
        print('model moved')
    else
        position = Vector3.new(0,0,0)
        wait(5)
        deb = true
        model:SetPrimaryPartCFrame(CFrame.new(position))
    end
end)

where it says position = Vector3.new(0,0,0), change that to your coordinates

0
helpful ill give it a shot but how do i move them back after five minutes thedogegamer22 -44 — 6y
0
wait ill edit it greatneil80 2647 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

if the models are in a storage service then maybe use a table to spawn them in

local models = {
    game.ServerStorage.SpoopyMonster1,
    game.ServerStorage.SpoopyMonster2,
    game.ServerStorage.SpoopyMonster3
}

function Touch(h)
    if h and h.Parent and h.Parent:FindFirstChildOfClass("Humanoid") then
        for k, v in pairs(models)
            v.Parent = workspace
        end
        wait(60*5) -- five min
        for k, v in pairs(models)
            v.Parent = game.SeverStorage
        end
    end
end

workspace.SpoopyPart.Touched:Connect(Touch)