so im trying to make a cat that can walk to different windows, however after the first window it goes to, its positioning gets all messed up.
--SERVICES--
local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")
local TInfo = TweenInfo.new(10)
local SInfo = TweenInfo.new(3)
--OBJECTS--
local Windows = workspace.Windows:GetChildren()
local Debounce = false
local Maxwell = ServerStorage.maxwell
local Humanoid = Maxwell.Humanoid
--ANIMS--
local ShakeAnim = Instance.new("Animation")
ShakeAnim.AnimationId = Maxwell.Shake.AnimationId
local ShakeAnimTrack = Humanoid:LoadAnimation(ShakeAnim)
while task.wait(math.random(1, 10)) do
if Debounce == false then
Debounce = true
ShakeAnimTrack:Stop()
local random = Windows[math.random(1, #Windows)]
random.Window.Material = Enum.Material.Neon
Maxwell.HumanoidRootPart.Position = random.Spawn.Position
Maxwell.Parent = workspace
Maxwell.maxwell.Size = Vector3.new(5.096, 3.005, 2.579)
print(Maxwell.HumanoidRootPart.Position)
print(random.Spawn.Position)
random.Window.ProximityPrompt.Enabled = true
task.wait()
local Tween = TweenService:Create(Maxwell.HumanoidRootPart, TInfo, {Position = random.Window.Position})
Tween:Play()
Maxwell.Weld.Position = Maxwell.HumanoidRootPart.Position
Tween.Completed:Connect(function()
random.Window.ProximityPrompt.Enabled = false
Tween:Destroy()
ShakeAnimTrack:Play()
local SizeTween = TweenService:Create(Maxwell.maxwell, SInfo, {Size = Vector3.new(9, 6, 5)})
SizeTween:Play()
ShakeAnimTrack.Stopped:Connect(function()
SizeTween:Destroy()
Maxwell.Parent = ServerStorage
Debounce = false
end)
end)
delay(1, function()
random.Window.Material = Enum.Material.SmoothPlastic
end)
elseif Debounce == true then
end
end
VIDEO:
EXPLORER:
any help is appreciated