Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- function Tween(obj,Goal,Time,Wait,...) local TwInfo = TweenInfo.new(Time,...) local twn = TweenService:Create(obj, TwInfo, Goal) twn:Play() if Wait then twn.Completed:wait() end return
- end
- local orgins = {} if script.Parent.Keys:FindFirstChild("Keys") then for i,v in pairs(script.Parent.Keys.Keys:GetChildren()) do orgins[v.Name] = {v.Position,v.Orientation} end else for i,v in pairs(script.Parent.Keys:GetChildren()) do if v:IsA("Model") then for a,b in pairs(v:GetChildren()) do orgins[v.Name] = {b.Position,b.Orientation} end end end end function AnimateKey(note1,px,py,pz,ox,oy,oz,Time) pcall(function() local obj = script.Parent.Keys.Keys:FindFirstChild(note1) if obj then local Properties = {} local OrginP = orgins[obj.Name][1] local OrginO = orgins[obj.Name][2] local changep = OrginP - Vector3.new(px,py,pz) local changeo = OrginO - Vector3.new(ox,oy,oz) Properties.Position = Vector3.new(obj.Position.x, changep.Y, changep.Z) Properties.Orientation = changeo Tween(obj,Properties,Time,Enum.EasingStyle.Linear) Properties = {} Properties.Position = Vector3.new(obj.Position.x,OrginP.y,OrginP.z) Properties.Orientation = OrginO Tween(obj,Properties,Time,Enum.EasingStyle.Linear) else print(note1..' was not found, or you do not have the correct configuration for the piano keys') end end) end
- --[[
- AnimateKey(note1,px,py,pz,ox,oy,oz,Time)
- --note1(1-61), position x, position y, position z, orientation x, orientation y, orientation z, time
- local obj = --object or gui or wahtever goes here
- local Properties = {}
- Properties.Size = UDim2.new()
- Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
- --Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement