Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Breeds = {
- { -- Brown
- fur=BrickColor.new("Brown"),
- mane=BrickColor.new("Nougat"),
- saddle=BrickColor.Black(),
- reins=BrickColor.Black(),
- hoof=BrickColor.Black()
- },
- { -- Black
- fur=BrickColor.Black(),
- mane=BrickColor.new("Really black"),
- saddle=BrickColor.new("Brown"),
- reins=BrickColor.new("Brown"),
- hoof=BrickColor.new("Dark stone grey")
- },
- { -- Grey
- fur=BrickColor.new("Dark stone grey"),
- mane=BrickColor.Black(),
- saddle=BrickColor.new("Brown"),
- reins=BrickColor.new("Brown"),
- hoof=BrickColor.Black()
- },
- { -- White
- fur=BrickColor.new("Light stone grey"),
- mane=BrickColor.new("Medium stone grey"),
- saddle=BrickColor.Black(),
- reins=BrickColor.Black(),
- hoof=BrickColor.Black()
- }
- }
- local Breed = Breeds[math.random(1,#Breeds)]
- local ModelName = "Horse"
- local ModelParent = workspace
- --pcall(function() ModelParent[ModelName]:Destroy() end)
- local ReinsHold = nil
- local Height = 6.2
- local rHeight = Height
- local HasHat = true
- local HatMeshId = "rbxassetid://42157240"
- local HatTexId = ""
- local HorseColor = Breed.fur
- local EyeColor = BrickColor.new("Really black")
- local ManeColor = Breed.mane
- local SaddleColor = Breed.saddle
- local ReinsColor = Breed.reins
- local HoofColor = Breed.hoof
- local oc = oc or function(...) return ... end
- local ModelScale = .6
- local Speed = 0
- local WalkSpeed = 15
- local WalkSin = 6
- local TrotSpeed = 30
- local TrotSin = 4
- local GallopSin = 20
- local MaxSpeed = 100
- local SpeedLimit = 100
- local startpos = workspace.djroese.Head.CFrame * CFrame.new(0,Height+1.5,10)--script.Parent:IsA("BasePart") and script.Parent.CFrame * CFrame.new(0,Height,0) or CFrame.new(0,Height+1,20)
- math.randomseed(tick()+215819240)
- math.random() math.random() math.random()
- aran = function() return math.random() end
- ran = function() return (math.random()-.5)*2 end
- function Weld(a,b,c,d)
- local w = Instance.new("Weld",a)
- w.Part0 = a
- w.Part1 = b
- w.C0 = c or CFrame.new()
- w.C1 = d or CFrame.new()
- return w
- end
- do -- Ignore my clerp stuff stolen from stravvy
- local function QuaternionFromCFrame(cf)
- local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
- local trace = m00 + m11 + m22
- if trace > 0 then
- local s = math.sqrt(1 + trace)
- local recip = 0.5/s
- return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
- else
- local i = 0
- if m11 > m00 then
- i = 1
- end
- if m22 > (i == 0 and m00 or m11) then
- i = 2
- end
- if i == 0 then
- local s = math.sqrt(m00-m11-m22+1)
- local recip = 0.5/s
- return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
- elseif i == 1 then
- local s = math.sqrt(m11-m22-m00+1)
- local recip = 0.5/s
- return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
- elseif i == 2 then
- local s = math.sqrt(m22-m00-m11+1)
- local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
- end
- end
- end
- local function QuaternionToCFrame(px, py, pz, x, y, z, w)
- local xs, ys, zs = x + x, y + y, z + z
- local wx, wy, wz = w*xs, w*ys, w*zs
- local xx = x*xs
- local xy = x*ys
- local xz = x*zs
- local yy = y*ys
- local yz = y*zs
- local zz = z*zs
- return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
- end
- local function QuaternionSlerp(a, b, t)
- local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
- local startInterp, finishInterp;
- if cosTheta >= 0.0001 then
- if (1 - cosTheta) > 0.0001 then
- local theta = math.acos(cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((1-t)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = 1-t
- finishInterp = t
- end
- else
- if (1+cosTheta) > 0.0001 then
- local theta = math.acos(-cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((t-1)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = t-1
- finishInterp = t
- end
- end
- return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
- end
- function clerp(a,b,t)
- local qa = {QuaternionFromCFrame(a)}
- local qb = {QuaternionFromCFrame(b)}
- local ax, ay, az = a.x, a.y, a.z
- local bx, by, bz = b.x, b.y, b.z
- local _t = 1-t
- return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
- end
- end
- function lerp(a,b,c)
- return a+(b-a)*c
- end
- function ctlerp(c1,c2,al) -- Older, "worse" clerp if the other one fails..
- local com1 = {c1:components()}
- local com2 = {c2:components()}
- for i,v in pairs(com1) do
- com1[i] = lerp(v,com2[i],al)
- end
- return CFrame.new(unpack(com1))
- end
- local Model = Instance.new("Model",ModelParent)
- Model.Name = ModelName
- local BasePart = Instance.new("Part")
- BasePart.FormFactor = "Custom"
- BasePart.Size = Vector3.new()
- BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10
- BasePart:BreakJoints()
- BasePart.CFrame = startpos
- function NP()
- local p = BasePart:Clone()
- p.Parent = Model
- return p
- end
- function Sphere(parent,scale)
- local sm = Instance.new("SpecialMesh",parent)
- sm.MeshType = "Sphere"
- sm.Scale = scale or Vector3.new(1,1,1)
- return sm
- end
- BasePart.BrickColor = HorseColor
- local Main = NP()
- Main.Size = Vector3.new(3.5,4.5,8)
- Main.CFrame = startpos
- MainMesh = Sphere(Main)
- local Neck = NP()
- Neck.Size = Vector3.new(2,5,2.5)
- local NeckWeld = Weld(Main,Neck,CFrame.new(0,0.5,-3.2)*CFrame.Angles(math.rad(-20),0,0),CFrame.new(0,-1.5,0))
- local NeckWeld0 = NeckWeld.C0
- Sphere(Neck,Vector3.new(1,1,1))
- local NeckBonus = NP()
- NeckBonus.Size = Vector3.new(1.9,3,2)
- Weld(Neck,NeckBonus,CFrame.new(0,-1.1,.5)*CFrame.Angles(-.5,0,0))
- Sphere(NeckBonus)
- local Head = NP()
- Head.Size = Vector3.new(2,3,3)
- local HeadWeld = Weld(Neck,Head,CFrame.new(0,2.5,-.4),CFrame.new(0,0,1))
- local HeadWeld0 = HeadWeld.C0
- local HeadMesh = Instance.new("SpecialMesh",Head)
- HeadMesh.Scale = Vector3.new(0.7,1,1)*1.6
- HeadMesh.MeshId = "http://www.roblox.com/asset/?id=114690930"
- if HasHat then
- local Hat = NP()
- Hat.Size = Vector3.new()
- Hat.BrickColor = SaddleColor
- local HatWeld = Weld(Head,Hat,CFrame.new(0,1.11,1.3),CFrame.Angles(math.rad(-20),0,0))
- local HatMesh = Instance.new("SpecialMesh",Hat)
- HatMesh.Scale = Vector3.new(1.5,1.5,1.5)
- HatMesh.MeshId = HatMeshId or "rbxassetid://42157240"
- HatMesh.TextureId = HatTexId or ""
- end
- local EyeR = NP()
- EyeR.BrickColor = EyeColor
- EyeR.Reflectance = .1
- EyeR.Size = Vector3.new(.2,.2,.2)
- Weld(Head,EyeR,CFrame.new(.631,.23,.11)*CFrame.Angles(-0.2,0.1,0))
- Sphere(EyeR,Vector3.new(.9,2.1,2.1))
- local EyeL = NP()
- EyeL.BrickColor = EyeColor
- EyeL.Reflectance = .1
- EyeL.Size = Vector3.new(.2,.2,.2)
- Weld(Head,EyeL,CFrame.new(-.631,.23,.11)*CFrame.Angles(-0.2,-0.1,0))
- Sphere(EyeL,Vector3.new(.9,2.1,2.1))
- BasePart.Name = "Reins"
- local RPart = NP() -- rs1
- RPart.BrickColor = ReinsColor
- RPart.Size = Vector3.new(.2,.7,.25)
- Weld(Head,RPart,CFrame.new(.4,-.5,-1.05)*CFrame.Angles(-.25,0,0))
- local Cyl = NP()
- Cyl.BrickColor = ReinsColor
- Cyl.Size = Vector3.new(.2495,.2,.2)
- Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
- Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
- local RPart = NP() -- rs2
- RPart.BrickColor = ReinsColor
- RPart.Size = Vector3.new(.2,.4,.25)
- Weld(Head,RPart,CFrame.new(.4,-.5,-1.05)*CFrame.Angles(-.25,0,0)*CFrame.new(0,-.35,0)*CFrame.Angles(0,0,-.5)*CFrame.new(0,-.2,0))
- local Cyl = NP()
- Cyl.BrickColor = ReinsColor
- Cyl.Size = Vector3.new(.2495,.2,.2)
- Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
- Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CFrame.Angles(0,math.pi/2,0))
- local ReinAnchorR = Cyl
- local RPart = NP() -- ls1
- RPart.BrickColor = ReinsColor
- RPart.Size = Vector3.new(.2,.7,.25)
- Weld(Head,RPart,CFrame.new(-.4,-.5,-1.05)*CFrame.Angles(-.25,0,0))
- local Cyl = NP()
- Cyl.BrickColor = ReinsColor
- Cyl.Size = Vector3.new(.2495,.2,.2)
- Instance.new("SpecialMesh",Cyl).MeshType = "Cylinder"
- Weld(RPart,Cyl,CFrame.new(0,RPart.Size.Y/2,0)*CF…
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement