Advertisement
facedwarrior193

some roblox scripts i made

Oct 10th, 2023
1,383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.08 KB | Source Code | 0 0
  1. local module = {}
  2. local mul = 1.05
  3. local tweenService = game:GetService("TweenService")
  4. local tween
  5. local hoverSound = game.ReplicatedStorage.sounds.onHover
  6.  
  7. function module.AddBounce(gui :TextButton,changeColor :boolean)
  8.  
  9.     local originColor = gui.BackgroundColor3
  10.     local originSize = gui.Size
  11.    
  12.    
  13.     gui.MouseEnter:Connect(function()
  14.         local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  15.         local tweenData = {Size = UDim2.new(originSize.X.Scale * mul,0,originSize.Y.Scale * mul,0)}
  16.        
  17.         if changeColor then
  18.             tweenData = {Size = UDim2.new(originSize.X.Scale * mul,0,originSize.Y.Scale * mul,0),BackgroundColor3 = Color3.new(0.917647, 0.917647, 0.917647),TextColor3 = Color3.new(0,0,0)}
  19.         end
  20.        
  21.         --playing the hover sound
  22.         hoverSound:Play()
  23.        
  24.        
  25.         tween = tweenService:Create(gui,tweenInfo,tweenData)
  26.         tween:Play()
  27.        
  28.        
  29.        
  30.        
  31.         gui.MouseLeave:Once(function()
  32.             local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
  33.             local tweenData = {Size = UDim2.new(originSize.X.Scale,0,originSize.Y.Scale,0)}
  34.             if changeColor then
  35.                 tweenData = {Size = UDim2.new(originSize.X.Scale,0,originSize.Y.Scale,0),BackgroundColor3 = originColor,TextColor3 = Color3.new(255,255,255)}
  36.             end
  37.             tween = tweenService:Create(gui,tweenInfo,tweenData)
  38.             tween:Play()
  39.         end)
  40.     end)
  41. end
  42. return module
  43.  
  44.  
  45. local module = {}
  46.  
  47. --Variables
  48. local finalSize = UDim2.new(0.750649333, 0, 0.261096597, 0)
  49. local inititalSize = UDim2.new(0, 0, 0.261096597, 0)
  50. local player = game.Players.LocalPlayer
  51. local playerGui = player.PlayerGui
  52. local typeWriterGui = playerGui.typeWriter
  53. local holder = typeWriterGui.holder
  54. local textLabel = holder.textHolder
  55. local sounds = game.ReplicatedStorage.sounds
  56.  
  57. --config
  58. local delayBetnEachCharacter = 0.1
  59. local opencloseDelay = 0.5
  60.  
  61. --services
  62. local TweenService = game:GetService("TweenService")
  63.  
  64.  
  65. function module:open()
  66.     local tweenInfo = TweenInfo.new(opencloseDelay,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
  67.     local tweenProperties = {Size = finalSize}
  68.     local tween = TweenService:Create(holder,tweenInfo,tweenProperties)
  69.     tween:Play()
  70. end
  71.  
  72. function module:getWaitingTime()
  73.     return opencloseDelay
  74. end
  75.  
  76.  
  77. function module:close()
  78.     local tweenInfo = TweenInfo.new(opencloseDelay,Enum.EasingStyle.Quad,Enum.EasingDirection.In)
  79.     local tweenProperties = {Size = inititalSize}
  80.     local tween = TweenService:Create(holder,tweenInfo,tweenProperties)
  81.     tween:Play()
  82. end
  83.  
  84. function module:Write(text :string)
  85.     for i=1,#text do
  86.         local curr = sounds:FindFirstChild("typeWriter"..tostring(math.random(1,3)))
  87.         curr:Play()
  88.         textLabel.Text = string.sub(text, 1, i)
  89.         task.wait(delayBetnEachCharacter)
  90.     end
  91. end
  92.  
  93. return module
  94. local module = {}
  95. local gui = script.Parent.damage_indicator.Part
  96. local debris = game:GetService("Debris")
  97. function module.add(char)
  98.     local hum = char:WaitForChild("Humanoid")
  99.     local oldHealth = hum.Health
  100.     local hrp = char:WaitForChild("HumanoidRootPart")
  101.     hum.HealthChanged:Connect(function(newHealth)
  102.         if oldHealth>newHealth then
  103.             e(math.floor(newHealth-oldHealth),hrp)
  104.            
  105.         end
  106.         oldHealth = newHealth
  107.     end)
  108. end
  109.  
  110.  
  111. function e(num,part)
  112.     local x = math.random(-5,5)
  113.     local y = math.random(-5,5)
  114.     local z = math.random(-5,5)
  115.     local temp = gui:Clone()
  116.     temp.Parent = workspace
  117.     temp.BillboardGui.TextLabel.Text = num
  118.     temp.Position = part.Position + Vector3.new(x,y,z)
  119.     debris:AddItem(temp,2)
  120. end
  121. return module
  122. local module = {}
  123.  
  124.  
  125. local tween = game:GetService("TweenService")
  126. function module.click(startingpos,targetpos,char)
  127.    
  128.     local hum = char:WaitForChild("Humanoid")
  129.     hum.WalkSpeed = 0
  130.    
  131.    
  132.     hum.JumpPower = 0
  133.     local myPart = Instance.new("Part")
  134.     myPart.Color = Color3.new(0.458824, 0.458824, 0.133333)
  135.     myPart.Parent = game.Workspace
  136.     myPart.CanCollide = false
  137.     myPart.Anchored = true
  138.     myPart.Size = Vector3.new(2,2,0.5)
  139.     myPart.Position = startingpos
  140.     myPart.CFrame = CFrame.lookAt(startingpos,targetpos)
  141.    
  142.     --casting a ray towards the thing
  143.     local rayStart = startingpos
  144.     local rayDirection = (targetpos-startingpos)
  145.    
  146.     local rayParms = RaycastParams.new()
  147.     rayParms.FilterDescendantsInstances = {char,myPart}
  148.     rayParms.FilterType = Enum.RaycastFilterType.Exclude
  149.     rayParms.IgnoreWater = true
  150.    
  151.    
  152.     local raycastResult = workspace:Raycast(rayStart, rayDirection,rayParms)
  153.    
  154.     repeat wait() until raycastResult
  155.     print(raycastResult.Instance)
  156.    
  157.     local armlength = 100 --studs
  158.     local deltaSize = Vector3.new(0,0,-armlength)
  159.    
  160.    
  161.     --tweening the part
  162.     local goal = {}
  163.     goal.Size = Vector3.new(2,2,armlength)
  164.     goal.Position = myPart.CFrame:PointToWorldSpace(deltaSize/2)
  165.     local Tweenin = TweenInfo.new(armlength/500,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0,true)
  166.     local x = tween:Create(myPart,Tweenin,goal)
  167.    
  168.    
  169.     x:Play()
  170.     x.Completed:Connect(function()
  171.         myPart:Destroy()
  172.         hum.WalkSpeed = 16
  173.         hum.JumpPower = 50
  174.     end)
  175. end
  176.  
  177. function fling(char)
  178.     local hrp = char:WaitForChild("HumanoidRootPart")
  179.     hrp.AssemblyLinearVelocity = Vector3.new(math.random(1,100),math.random(1,100),math.random(1,100))
  180. end
  181.  
  182.  
  183.  
  184.  
  185. return module
  186.  
  187.  
  188.  
  189.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement