
Keyless

local players = game:GetService("Players")
local player = players.LocalPlayer
local visitedPumpkins = {}
local function getRootPart()
local character = player.Character or player.CharacterAdded:Wait()
return character:WaitForChild("HumanoidRootPart", 5)
end
local function findNextPumpkin(currentPos)
local nearestPumpkin = nil
local shortestDistance = math.huge
for _, obj in ipairs(workspace:GetDescendants()) do
if not visitedPumpkins[obj] and (obj:IsA("BasePart") or obj:IsA("Model")) then
if obj.Name:lower():find("pumpkin") then
local targetPart = obj:IsA("Model") and (obj.PrimaryPart or obj:FindFirstChildWhichIsA("BasePart")) or obj
if targetPart then
local distance = (currentPos - targetPart.Position).Magnitude
if distance < shortestDistance then
shortestDistance = distance
nearestPumpkin = {object = obj, part = targetPart}
end
end
end
end
end
return nearestPumpkin
end
task.spawn(function()
while true do
local rootPart = getRootPart()
if rootPart then
local nextPumpkin = findNextPumpkin(rootPart.Position)
if nextPumpkin then
visitedPumpkins[nextPumpkin.object] = true
rootPart.CFrame = nextPumpkin.part.CFrame + Vector3.new(0, 3, 0)
task.wait(1)
else
-- If you see this say hi and thnaks for using my script
task.wait(2)
end
else
task.wait(1)
end
end
end)
经验经验经验经验
@QTEN uhh yes
this works only during the halloween night is on no menu
@odeyiscat yes ofc it only works during the night thats where the event is we cant just spawn the event but thanks for using my script 👍