Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Made By Bartus2009_Bro/GabeTheDog
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- RemoteEvent1 = Instance.new("RemoteEvent")
- RemoteEvent2 = Instance.new("RemoteEvent")
- LocalScript3 = Instance.new("LocalScript")
- Script4 = Instance.new("Script")
- Configuration5 = Instance.new("Configuration")
- NumberValue6 = Instance.new("NumberValue")
- NumberValue7 = Instance.new("NumberValue")
- NumberValue8 = Instance.new("NumberValue")
- NumberValue9 = Instance.new("NumberValue")
- NumberValue10 = Instance.new("NumberValue")
- NumberValue11 = Instance.new("NumberValue")
- NumberValue12 = Instance.new("NumberValue")
- Sound13 = Instance.new("Sound")
- Sound14 = Instance.new("Sound")
- Part15 = Instance.new("Part")
- BillboardGui16 = Instance.new("BillboardGui")
- ImageLabel17 = Instance.new("ImageLabel")
- CFrameValue18 = Instance.new("CFrameValue")
- Weld19 = Instance.new("Weld")
- RemoteEvent20 = Instance.new("RemoteEvent")
- Tool0.Name = "Pistol"
- Tool0.Parent = mas
- Tool0.TextureId = "rbxassetid://131768786"
- Tool0.GripForward = Vector3.new(0.997598529, -0, -0.0692615658)
- Tool0.GripPos = Vector3.new(-0.792874813, -0.37231636, 0.112739533)
- Tool0.GripRight = Vector3.new(0.0692615658, 0, 0.997598529)
- Tool0.ToolTip = "Activate the Trigger Happy special by pressing E or using the mobile button!"
- RemoteEvent1.Name = "Hit"
- RemoteEvent1.Parent = Tool0
- RemoteEvent2.Name = "Fire"
- RemoteEvent2.Parent = Tool0
- LocalScript3.Name = "Client"
- LocalScript3.Parent = Tool0
- table.insert(cors,sandbox(LocalScript3,function()
- --//Variables\\--
- local tool = script.Parent
- local handle = tool:WaitForChild("Handle")
- local contextActionService = game:GetService("ContextActionService")
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local character = player.Character or player.CharacterAdded:Wait()
- local enabled = true
- local specialDB = true
- local cursorId = "http://www.roblox.com/asset/?id=251497633"
- local hitId = "http://www.roblox.com/asset/?id=70785856"
- local configs = tool:WaitForChild("Configurations")
- local fireRate = configs:FindFirstChild("FireRate")
- local specialRechargeTime = configs:FindFirstChild("SpecialRechargeTime")
- local fire = tool:WaitForChild("Fire")
- local activateSpecial = tool:WaitForChild("ActivateSpecial")
- local hit = tool:WaitForChild("Hit")
- --//Custom Functions\\--
- function activate()
- if specialDB then
- specialDB = false
- activateSpecial:FireServer()
- else
- end
- end
- --//Tool Function\\--
- tool.Equipped:Connect(function()
- contextActionService:BindAction("ActivateSpecial", activate, true, Enum.KeyCode.E)
- contextActionService:SetImage("ActivateSpecial", tool.TextureId)
- contextActionService:SetPosition("ActivateSpecial", UDim2.new(0.72, -25, 0.20, -25))
- mouse.Icon = cursorId
- end)
- tool.Unequipped:Connect(function()
- contextActionService:UnbindAction("ActivateSpecial")
- mouse.Icon = ""
- end)
- tool.Activated:Connect(function()
- if not enabled then return end
- enabled = false
- fire:FireServer(mouse.Hit)
- wait(fireRate.Value)
- enabled = true
- end)
- hit.OnClientEvent:Connect(function()
- mouse.Icon = hitId
- handle.Hitmark:Play()
- wait(0.075)
- mouse.Icon = cursorId
- end)
- activateSpecial.OnClientEvent:Connect(function()
- for i = specialRechargeTime.Value, 0, -1 do
- wait(1)
- specialDB = false
- print("Recharging: "..i)
- end
- specialDB = true
- end)
- end))
- Script4.Name = "Server"
- Script4.Parent = Tool0
- table.insert(cors,sandbox(Script4,function()
- --//Variables\\--
- local tool = script.Parent
- local handle = tool:WaitForChild("Handle")
- local muzzle = tool:WaitForChild("Muzzle")
- local muzzleFlash = muzzle:WaitForChild("MuzzleFlash")
- local muzzleEffect = muzzleFlash:WaitForChild("MuzzleEffect")
- local configs = tool:WaitForChild("Configurations")
- local fireRate = configs:FindFirstChild("FireRate")
- local maxDamage = configs:FindFirstChild("MaxDamage")
- local minDamage = configs:FindFirstChild("MinDamage")
- local velocity = configs:FindFirstChild("Velocity")
- local accuracy = configs:FindFirstChild("Accuracy")
- local specialDuration = configs:FindFirstChild("SpecialDuration")
- local specialRechargeTime = configs:FindFirstChild("SpecialRechargeTime")
- local showDamageText = true
- local debris = game:GetService("Debris")
- local fire = tool:WaitForChild("Fire")
- local activateSpecial = tool:WaitForChild("ActivateSpecial")
- local hit = tool:WaitForChild("Hit")
- --//Custom Functions\\--
- function TagHumanoid(humanoid, player)
- local Creator_Tag = Instance.new("ObjectValue")
- Creator_Tag.Name = "creator"
- Creator_Tag.Value = player
- debris:AddItem(Creator_Tag, 0.3)
- Creator_Tag.Parent = humanoid
- end
- function UntagHumanoid(humanoid)
- for i, v in pairs(humanoid:GetChildren()) do
- if v:IsA("ObjectValue") and v.Name == "creator" then
- v:Destroy()
- end
- end
- end
- function TextEffects(element, floatAmount, direction, style, duration)
- element:TweenPosition(UDim2.new(0, math.random(-40, 40), 0, -floatAmount), direction, style, duration)
- wait(0.5)
- for i = 1, 60 do
- element.TextTransparency = element.TextTransparency + 1/60
- element.TextStrokeTransparency = element.TextStrokeTransparency + 1/60
- wait(1/60)
- end
- element.TextTransparency = element.TextTransparency + 1
- element.TextStrokeTransparency = element.TextStrokeTransparency + 1
- element.Parent:Destroy()
- end
- function DynamicText(damage, criticalPoint, humanoid)
- local bill = Instance.new("BillboardGui", humanoid.Parent.Head)
- bill.Size = UDim2.new(0, 50, 0, 100)
- local part = Instance.new("TextLabel", bill)
- bill.AlwaysOnTop = true
- part.TextColor3 = Color3.fromRGB(255, 0, 0)
- part.Text = damage
- part.Font = Enum.Font.SourceSans
- part.TextStrokeTransparency = 0
- part.Size = UDim2.new(1, 0, 1, 0)
- part.Position = UDim2.new(0, 0, 0, 0)
- part.BackgroundTransparency = 1
- bill.Adornee = bill.Parent
- if damage < criticalPoint then
- part.TextSize = 28
- part.TextColor3 = Color3.new(1, 0, 0)
- elseif damage >= criticalPoint then
- part.TextSize = 32
- part.TextColor3 = Color3.new(1, 1, 0)
- end
- spawn(function()
- TextEffects(part, 85, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.75)
- end)
- end
- function DamageAndTagHumanoid(player, humanoid, damage)
- hit:FireClient(player)
- UntagHumanoid(handle)
- humanoid:TakeDamage(damage) TagHumanoid(humanoid, player)
- end
- --//Remote Functions\\--
- fire.OnServerEvent:Connect(function(player, mouseHit)
- local character = player.Character
- local humanoid = character:FindFirstChild("Humanoid")
- local weaponAccuracy = Vector3.new(math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2))
- if humanoid and humanoid ~= 0 then
- local projectile = Instance.new("Part", workspace)
- local trail = Instance.new("Trail", projectile)
- trail.FaceCamera = true
- trail.Lifetime = 0.3
- trail.MinLength = 0.15
- trail.LightEmission = 0.25
- local attachment0 = Instance.new("Attachment", projectile)
- attachment0.Position = Vector3.new(0.35, 0, 0)
- attachment0.Name = "Attachment1"
- local attachment1 = Instance.new("Attachment", projectile)
- attachment1.Position = Vector3.new(-0.35, 0, 0)
- attachment1.Name = "Attachment1"
- trail.Attachment0 = attachment0
- trail.Attachment1 = attachment1
- projectile.Name = "Bullet"
- projectile.BrickColor = BrickColor.new("Smoky gray")
- projectile.Shape = "Ball"
- projectile.Material = Enum.Material.Metal
- projectile.TopSurface = 0
- projectile.BottomSurface = 0
- projectile.Size = Vector3.new(1, 1, 1)
- projectile.Transparency = 1
- projectile.CFrame = CFrame.new(muzzle.CFrame.p, mouseHit.p)
- projectile.CanCollide = false
- local transparencyPoints = {}
- local startColor = Color3.new(255, 255, 0)
- local endColor = Color3.new(213, 115, 61)
- table.insert(transparencyPoints, NumberSequenceKeypoint.new(0, 1))
- table.insert(transparencyPoints, NumberSequenceKeypoint.new(0.25, 0))
- table.insert(transparencyPoints, NumberSequenceKeypoint.new(1, 1))
- local determinedTransparency = NumberSequence.new(transparencyPoints)
- local determinedColors = ColorSequence.new(startColor, endColor)
- trail.Transparency = determinedTransparency
- trail.Color = determinedColors
- local bodyVelocity = Instance.new("BodyVelocity", projectile)
- bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
- bodyVelocity.Velocity = (mouseHit.lookVector * velocity.Value) + weaponAccuracy
- debris:AddItem(projectile, 20)
- projectile.Touched:Connect(function(hit)
- local eHumanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
- local damage = math.random(minDamage.Value, maxDamage.Value)
- if not eHumanoid and not hit.Anchored and not hit:IsDescendantOf(character) then
- projectile:Destroy()
- elseif eHumanoid and eHumanoid ~= humanoid and eHumanoid.Health > 0 and hit ~= projectile then
- if hit.Name == "Head" or hit:IsA("Hat") then
- damage = damage * 1.5
- end
- local criticalPoint = maxDamage.Value
- DamageAndTagHumanoid(player, eHumanoid, damage)
- if showDamageText then
- DynamicText(damage, criticalPoint, eHumanoid)
- else
- end
- projectile:Destroy()
- elseif hit.CanCollide == true and not hit:IsDescendantOf(player.Character) and hit.Anchored == true then
- projectile:Destroy()
- end
- end)
- handle.Fire:Play()
- muzzleEffect.Visible = true
- muzzleEffect.Rotation = math.random(-360, 360)
- delay(0.1, function()
- muzzleEffect.Visible = false
- end)
- end
- end)
- activateSpecial.OnServerEvent:Connect(function(player)
- accuracy.Value, fireRate.Value = accuracy.Value / 2, fireRate.Value / 2
- minDamage.Value, maxDamage.Value = minDamage.Value / 2, maxDamage.Value / 2
- spawn(function()
- local chargeSound = Instance.new("Sound", player.PlayerGui)
- chargeSound.Name = "ChargeSound"
- chargeSound.SoundId = "rbxassetid://163619849"
- chargeSound:Play()
- chargeSound.Ended:Connect(function() chargeSound:Destroy() end)
- local sparkles = Instance.new("Sparkles", handle)
- sparkles.SparkleColor = Color3.fromRGB(255, 236, 21)
- local activatedGui = Instance.new("ScreenGui", player.PlayerGui)
- activatedGui.Name = "SpecialActivated"
- local textLabel = Instance.new("TextLabel", activatedGui)
- textLabel.TextColor3 = Color3.fromRGB(0, 180, 30)
- textLabel.Text = "Trigger Happy activated!"
- textLabel.Font = Enum.Font.SourceSans
- textLabel.TextScaled = true
- textLabel.TextStrokeTransparency = 0
- textLabel.Size = UDim2.new(0, 300, 0, 50)
- textLabel.Position = UDim2.new(2.5, 0, 0.15, -10)
- textLabel.BackgroundTransparency = 1
- textLabel:TweenPosition(UDim2.new(0.5, -(textLabel.Size.X.Offset / 2), 0.1, -10), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1)
- debris:AddItem(sparkles, specialDuration.Value)
- debris:AddItem(chargeSound, 3)
- wait(3)
- TextEffects(textLabel, 200, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
- end)
- for i = specialDuration.Value, 0, -1 do
- wait(1)
- print("Special activated: "..i)
- end
- accuracy.Value, fireRate.Value = accuracy.Value * 2, fireRate.Value * 2
- minDamage.Value, maxDamage.Value = minDamage.Value * 2, maxDamage.Value * 2
- activateSpecial:FireClient(player)
- end)
- end))
- Configuration5.Name = "Configurations"
- Configuration5.Parent = Tool0
- NumberValue6.Name = "FireRate"
- NumberValue6.Parent = Configuration5
- NumberValue6.Value = 0.175
- NumberValue7.Name = "MinDamage"
- NumberValue7.Parent = Configuration5
- NumberValue7.Value = 14
- NumberValue8.Name = "MaxDamage"
- NumberValue8.Parent = Configuration5
- NumberValue8.Value = 17
- NumberValue9.Name = "Velocity"
- NumberValue9.Parent = Configuration5
- NumberValue9.Value = 625
- NumberValue10.Name = "Accuracy"
- NumberValue10.Parent = Configuration5
- NumberValue10.Value = 9
- NumberValue11.Name = "SpecialDuration"
- NumberValue11.Parent = Configuration5
- NumberValue11.Value = 15
- NumberValue12.Name = "SpecialRechargeTime"
- NumberValue12.Parent = Configuration5
- NumberValue12.Value = 60
- Sound13.Name = "Fire"
- Sound13.Parent = mas
- Sound13.SoundId = "rbxassetid://330704232"
- Sound13.Volume = 3
- Sound14.Name = "Hitmark"
- Sound14.Parent = mas
- Sound14.SoundId = "rbxassetid://160432334"
- Sound14.Volume = 10
- Part15.Name = "Muzzle"
- Part15.Parent = Tool0
- Part15.Transparency = 1
- Part15.Rotation = Vector3.new(-1.01999998, 86.0299988, 0)
- Part15.CanCollide = false
- Part15.Size = Vector3.new(0.100000001, 0.100000001, 0.100000001)
- Part15.CFrame = CFrame.new(-130.112228, 19.4021873, 39.8008919, 0.0692615658, 3.11348858e-09, 0.997598529, -0.0177569855, 0.999841571, 0.00123284035, -0.997440577, -0.0177996811, 0.0692505985)
- Part15.BottomSurface = Enum.SurfaceType.Smooth
- Part15.TopSurface = Enum.SurfaceType.Smooth
- Part15.Position = Vector3.new(-130.112228, 19.4021873, 39.8008919)
- Part15.Orientation = Vector3.new(-0.0700000003, 86.0299988, -1.01999998)
- BillboardGui16.Name = "MuzzleFlash"
- BillboardGui16.Parent = Part15
- BillboardGui16.Size = UDim2.new(0, 150, 0, 150)
- BillboardGui16.Active = true
- BillboardGui16.Adornee = Part15
- ImageLabel17.Name = "MuzzleEffect"
- ImageLabel17.Parent = BillboardGui16
- ImageLabel17.Transparency = 1
- ImageLabel17.Size = UDim2.new(1, 0, 1, 0)
- ImageLabel17.Visible = false
- ImageLabel17.BackgroundColor3 = Color3.new(1, 1, 1)
- ImageLabel17.BackgroundTransparency = 1
- ImageLabel17.Image = "rbxassetid://192664810"
- CFrameValue18.Name = "qRelativeCFrameWeldValue"
- CFrameValue18.Parent = Part15
- CFrameValue18.Value = CFrame.new(-1.15686202, -0.59147644, -0.005217731, 1.00000012, -2.42143869e-08, -6.51925802e-09, -2.42143869e-08, 1, 4.80213203e-09, -6.51925802e-09, 4.80213203e-09, 1)
- Weld19.Name = "qCFrameWeldThingy"
- Weld19.Parent = Part15
- Weld19.C1 = CFrame.new(-1.15686202, -0.59147644, -0.005217731, 1.00000012, -2.42143869e-08, -6.51925802e-09, -2.42143869e-08, 1, 4.80213203e-09, -6.51925802e-09, 4.80213203e-09, 1)
- Weld19.Part0 = nil
- Weld19.Part1 = Part15
- RemoteEvent20.Name = "ActivateSpecial"
- RemoteEvent20.Parent = Tool0
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement