what im trying to achieve is when a player touches a part, that part teleports to a set position of the map (after 5 minutes for example) then that part is touched again and gets teleported to another set position and so on.
i tried to do this with part cloning and destroying it when touched instead, that works just fine but my only problem with that is that i cannot figure out how to make scripts inside cloned parts work.
local part = game.Workspace.Part -- Chage part to your part name.
local partToTeleportTo = game.Workspace.TeleportPart
part.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not Player then return end
task.wait(300)
part.CFrame = partToTeleportTo.CFrame
end)
Make a part in workspace for the part to teleport to! Make sure it is CanCollide off, anchored, and named “TeleportPart”. This is just a rough baseplate for you, you can edit it if you’d like, but this is how you would do it!
local Players = game:GetService("Players")
local Block = script.Parent
--Put positions that the part will move to in order
local Positions = {
Vector3.new(0, 10, 10),
Vector3.new(50, 10, 5),
Vector3.new(100, 35, -15)
}
local CanTeleport, TimesTeleported = true, 0
Block.Touched:Connect(function(Part)
local Player = Players:GetPlayerFromCharacter(Part.Parent)
if not Player or not CanTeleport then
return
end
CanTeleport = false
TimesTeleported += 1
local Position = Positions[TimesTeleported]
if not Position then
return
end
Block.Position = Position
task.wait(300) --5 minutes
CanTeleport = true
end)