Advertisement
brianops1

TwoCustomFunctions

Oct 19th, 2019
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. 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
  3. end
  4.  
  5. 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
  6. --[[
  7. AnimateKey(note1,px,py,pz,ox,oy,oz,Time)
  8. --note1(1-61), position x, position y, position z, orientation x, orientation y, orientation z, time
  9.  
  10. local obj = --object or gui or wahtever goes here
  11. local Properties = {}
  12. Properties.Size = UDim2.new()
  13. Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
  14. --Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
  15. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement