Good day,
I created a script that moves a model to a specific position, and the part that receives the model changes folder (to distinguish part with something on it, and others not).
I would like to know how to detect when something is not on the part, to bring back the part to his original folder?
Thank you
local palPart = script.Parent
local db = true
local light = workspace.ReceivingPallet.GreenLight
local Model = workspace.pal12
local cpos = Model.PrimaryPart.Position
palPart.Touched:Connect(function(hit)
local palToClone = workspace.pal12
local palStorage = game.Workspace.emptyStorageLocation:GetChildren()
local numOfStorage = #palStorage
if db and palToClone then
db = false
local ss = game:GetService("ServerStorage")
local pal = ss:WaitForChild("pal12")
local randPalStorage = math.floor(math.random(1, numOfStorage))
local palClone = pal
palClone:Clone()
palClone.Parent = workspace
Model:SetPrimaryPartCFrame(palStorage[randPalStorage].CFrame + Vector3.new(0,0,0))
Model.Parent = workspace.storagePallet
end
end)

1 comment
My problem is that the model never touch the player in my game. I’m checking other forum post and maybe I need to give an attributes to the part to say when something touched, and loop to verify? But I’m new at this so I didn’t know how to make that happen…. :(