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
COMMUNITY QUESTION
how would i move a bunch of models when a part is touched?
2 answers
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
2 comments
0
helpful ill give it a shot but how do i move them back after five minutes
0
wait ill edit it
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
script pls