local w=script.Parent local n=w.PrimaryPart.CFrame local a=15 local g=w.PrimaryPart:WaitForChild("\066\111\100\121\071\121\114\111")local Q=w.PrimaryPart:WaitForChild("\066\111\100\121\080\111\115\105\116\105\111\110")Q.Position=n.p g.CFrame=w.PrimaryPart.CFrame local I=true local C=tick()function MoveShelly()Q.Parent=w.PrimaryPart local C repeat local g=Ray.new(Vector3.new(n.p.x+math.random(-a,a),w.PrimaryPart.Position.Y+100,n.p.z+math.random(-a,a)),Vector3.new(0,-130,0))local Q,I,W,P=workspace:FindPartOnRay(g,w)if Q==workspace.Terrain and P~=Enum.Material.Water then C=I+Vector3.new(0,.35,0)end wait()until C local W=w.PrimaryPart.Position local P=CFrame.new(Vector3.new(W.X,0,W.Z),Vector3.new(C.X,0,C.Z))g.CFrame=P Q.Position=(P*CFrame.new(0,0,-100)).p local V=tick()repeat wait(.5)local n=Ray.new(w.PrimaryPart.Position,Vector3.new(0,-140,0))until(w.PrimaryPart.Position-C).magnitude<10 or tick()-V>15 or not I if not I then Q.Parent,g.Parent=nil,nil return end Q.Parent=nil wait(math.random(3,8))end local W=game.ServerStorage.Sounds.NPC.Shelly:GetChildren()w.Health.Changed:connect(function()if I then Q.Parent,g.Parent=nil,nil w.PrimaryPart.Transparency=1 w.PrimaryPart.CanCollide=false w.Shell.Transparency=1 w.HitShell.Transparency=0 w.HitShell.CanCollide=true I=false C=tick()w:SetPrimaryPartCFrame(w.PrimaryPart.CFrame*CFrame.new(0,2,0))local n=W[math.random(1,#W)]:Clone()n.PlayOnRemove=true n.Parent=w.PrimaryPart wait()n:Destroy()repeat wait()until tick()-C>10 w.PrimaryPart.Transparency=0 w.PrimaryPart.CanCollide=true w.Shell.Transparency=0 w.HitShell.Transparency=1 w.HitShell.CanCollide=false Q.Parent,g.Parent=w.PrimaryPart,w.PrimaryPart I=true end end)while true do if I then MoveShelly()else wait(1)end end
--DevVince was here. :o
local shelly = script.Parent
local origin = shelly.PrimaryPart.CFrame
local tether = 15
local bg = shelly.PrimaryPart:WaitForChild("BodyGyro")
local bp = shelly.PrimaryPart:WaitForChild("BodyPosition")
bp.Position = origin.p
bg.CFrame = shelly.PrimaryPart.CFrame
local shellyGood = true
local ostrich = tick()

function MoveShelly()
	bp.Parent = shelly.PrimaryPart
	local goal
	repeat
		local ray = Ray.new(
			Vector3.new(
				origin.p.x + math.random(-tether, tether),
				shelly.PrimaryPart.Position.Y + 100,
				origin.p.z + math.random(-tether, tether)
			),
			Vector3.new(0, -130, 0)
		)
		local part, pos, norm, mat = workspace:FindPartOnRay(ray, shelly)
		if part == workspace.Terrain and mat ~= Enum.Material.Water then
			goal = pos + Vector3.new(0, 0.35, 0)
		end
		wait()
	until goal
	--Set new goal for banto to MoveTo :)
	local pos = shelly.PrimaryPart.Position
	local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
	bg.CFrame = cf
	bp.Position = (cf * CFrame.new(0, 0, -100)).p

	local start = tick()
	repeat
		wait(0.5)
		local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0, -140, 0))

	until (shelly.PrimaryPart.Position - goal).magnitude < 10 or tick() - start > 15 or not shellyGood
	if not shellyGood then
		bp.Parent, bg.Parent = nil, nil
		return
	end
	bp.Parent = nil
	wait(math.random(3, 8))
end

local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
	if shellyGood then
		bp.Parent, bg.Parent = nil, nil
		shelly.PrimaryPart.Transparency = 1
		shelly.PrimaryPart.CanCollide = false
		shelly.Shell.Transparency = 1
		shelly.HitShell.Transparency = 0
		shelly.HitShell.CanCollide = true
		shellyGood = false
		ostrich = tick()
		shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame * CFrame.new(0, 2, 0))
		local hitSound = soundBank[math.random(1, #soundBank)]:Clone()
		hitSound.PlayOnRemove = true
		hitSound.Parent = shelly.PrimaryPart
		wait()
		hitSound:Destroy()

		repeat
			wait()
		until tick() - ostrich > 10
		shelly.PrimaryPart.Transparency = 0
		shelly.PrimaryPart.CanCollide = true
		shelly.Shell.Transparency = 0
		shelly.HitShell.Transparency = 1
		shelly.HitShell.CanCollide = false
		bp.Parent, bg.Parent = shelly.PrimaryPart, shelly.PrimaryPart
		shellyGood = true
	end
end)

while true do
	if shellyGood then
		MoveShelly()
	else
		wait(1)
	end
end
