Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Tool = script.Parent
- local Player = game.Players.LocalPlayer
- local ContentProvider = game:GetService("ContentProvider")
- ContentProvider:Preload("rbxassetid://379973323")
- repeat wait() until Player.Character
- local Character = Player.Character
- local mouse = Player:GetMouse()
- print("Spooling up...")
- local LArm = Character:WaitForChild("Left Arm")
- local RArm = Character:WaitForChild("Right Arm")
- local LLeg = Character:WaitForChild("Left Leg")
- local RLeg = Character:WaitForChild("Right Leg")
- local Torso = Character:WaitForChild("Torso")
- local pulling = false
- local newZig = false
- --local oPaperScale = Tool.Paper.Mesh.Scale.y
- --local oTobaccyScale = Tool.Tobaccy.Mesh.Scale.y
- local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
- local RAD, SIN, ATAN, COS = math.rad, math.sin, math.atan2, math.cos
- local VEC3 = Vector3.new
- local CF, CFANG = CFrame.new, CFrame.Angles
- local INSERT = table.insert
- local Torso = Character:FindFirstChild("Torso")
- local rArm = Character:FindFirstChild("Right Arm")
- local lArm = Character:FindFirstChild("Left Arm")
- local rShoulder = Torso:FindFirstChild("Right Shoulder")
- local lShoulder = Torso:FindFirstChild("Left Shoulder")
- print("Found the shoulders")
- local rShoulderStorage = rShoulder:Clone()
- local lShoulderStorage = lShoulder:Clone()
- print("Cloned the shoulders.")
- local lit = false
- local ready = false
- local hasZig = false
- local currentZig
- local currentWeld
- local Animating = false
- local numberLeft = 20
- local drawing = false
- local heat = 0
- local size = 1000
- local minSize = 250
- local Selected = false
- local RS = game:GetService("RunService").RenderStepped
- function TweenJoint(Joint, NewC0, NewC1, Alpha, Duration)
- coroutine.resume(coroutine.create(function()
- local TweenIndicator = nil --At the current moment, this is how the script determines whether the function is already tweening a joint
- local NewCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
- if (not Joint:FindFirstChild("TweenCode")) then --If the joint isn't being tweened, then
- TweenIndicator = Instance.new("IntValue")
- TweenIndicator.Name = "TweenCode"
- TweenIndicator.Value = NewCode
- TweenIndicator.Parent = Joint
- else
- TweenIndicator = Joint.TweenCode
- TweenIndicator.Value = NewCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
- end
- local MatrixCFrame = function(CFPos, CFTop, CFBack)
- local CFRight = CFTop:Cross(CFBack)
- return CF(
- CFPos.x, CFPos.y, CFPos.z,
- CFRight.x, CFTop.x, CFBack.x,
- CFRight.y, CFTop.y, CFBack.y,
- CFRight.z, CFTop.z, CFBack.z
- )
- end
- local LerpCF = function(StartCF, EndCF, Alpha)
- local StartTop = (StartCF * CFANG(RAD(90), 0, 0)).lookVector
- local StartBack = -StartCF.lookVector
- local EndTop = (EndCF * CFANG(RAD(90), 0, 0)).lookVector
- local EndBack = -EndCF.lookVector
- local StartPos = StartCF.p
- local EndPos = EndCF.p
- local NewCF = MatrixCFrame(
- StartPos:lerp(EndPos, Alpha),
- StartTop:lerp(EndTop, Alpha),
- StartBack:lerp(EndBack, Alpha)
- )
- return NewCF
- end
- local StartC0 = Joint.C0
- local StartC1 = Joint.C1
- local X = 0
- while true do
- local NewX = X + math.min(1.5 / math.max(Duration, 0), 90)
- X = (NewX > 90 and 90 or NewX)
- if TweenIndicator.Value ~= NewCode then break end --This makes sure that another tween wasn't called on the same joint
- if (not Selected) then break end --This stops the tween if the tool is deselected
- if NewC0 then Joint.C0 = LerpCF(StartC0, NewC0, Alpha(X)) end
- if NewC1 then Joint.C1 = LerpCF(StartC1, NewC1, Alpha(X)) end
- if X == 90 then break end
- RS:wait() --This makes the for loop step every 1/60th of a second
- end
- if TweenIndicator.Value == NewCode then --If this tween functions was the last one called on a joint then it will remove the code
- TweenIndicator:Destroy()
- end
- end))
- end
- local Sine = function(X)
- return SIN(RAD(X))
- end
- local Linear = function(X)
- return (X / 90)
- end
- local GetPack = function(lWeld,packClone,defaultLArmC0,defaultLArmC1)
- TweenJoint(lWeld, defaultLArmC0 * CF(0,-0.05,0), defaultLArmC1 * CFANG(RAD(-8), RAD(25), RAD(-15)), Linear, 0.5 * 0.5)
- local packWeld = Instance.new("Weld")
- packWeld.Name = "packWeld"
- packWeld.Part0 = packClone
- packWeld.Part1 = lArm
- packWeld.C0 = CF(0,-0.7,-0.9) * CFANG(RAD(75),RAD(-8),RAD(180))
- packWeld.C1 = CF(0,0,0) --* CFANG(RAD(180),RAD(80),RAD(0))
- packWeld.Parent = packClone
- wait(0.5 * 0.5)
- packClone.Parent = lArm
- TweenJoint(lWeld, defaultLArmC0 * CF(0,-0.05,0), defaultLArmC1 * CFANG(RAD(-8), RAD(8), RAD(8)), Linear, 0.5 * 0.7)
- ready = true
- end
- Tool.Equipped:connect(function()
- Selected = true
- print("I'm selected.")
- packClone = game.Lighting.Zigaretenzeug.Pack:Clone()
- lWeld = Instance.new("Weld")
- lWeld.Name = "lWeld"
- lWeld.C0 = lShoulder.C0
- lWeld.C1 = lShoulder.C1
- lWeld.Part0 = Torso
- lWeld.Part1 = lArm
- rWeld = Instance.new("Weld")
- rWeld.Name = "rWeld"
- rWeld.C0 = rShoulder.C0
- rWeld.C1 = rShoulder.C1
- rWeld.Part0 = Torso
- rWeld.Part1 = rArm
- local defaultLArmC0 = lShoulder.C0
- local defaultLArmC1 = lShoulder.C1
- local defaultRArmC0 = rShoulder.C0
- local defaultRArmC1 = rShoulder.C1
- lShoulder:remove()
- rShoulder:remove()
- lWeld.Parent = Torso
- rWeld.Parent = Torso
- print("Weld cloned and parented.")
- GetPack(lWeld,packClone,defaultLArmC0,defaultLArmC1)
- mouse.Button1Down:connect(function()
- if not hasZig and ready and not pulling then
- pulling = true
- TweenJoint(lWeld, Tool.LeftValue.Value, CF(0,0,0), Linear, 0.5 * 0.7)
- TweenJoint(rWeld, Tool.RightValue.Value, CF(0,0,0), Linear, 0.5 * 0.7)
- wait(0.5 * 0.72)
- hasZig = true
- numberLeft = numberLeft - 1
- Tool.Name = "Izzurba - "..numberLeft.."/20"
- print("Zigareten left: "..numberLeft)
- heat = 0
- size = 2000
- minSize = 500
- local zigAnchor = game.Lighting.Zigaretenzeug.Zigareten.Paper:Clone()
- local anchorWeld = Instance.new("Weld")
- anchorWeld.Name = "anchorWeld"
- anchorWeld.Part0 = zigAnchor
- anchorWeld.Part1 = rArm
- anchorWeld.C0 = CF(-0.2,1,-0.2) * CFANG(RAD(0),RAD(0),RAD(0))
- anchorWeld.C1 = CF(0,0,0) * CFANG(RAD(0),RAD(180),RAD(0))
- anchorWeld.Parent = zigAnchor
- zigAnchor.Transparency = 1
- zigAnchor.Parent = rArm
- local zigClone = game.Lighting.Zigaretenzeug.Zigareten:Clone()
- zigWeld = Instance.new("Weld")
- zigWeld.Name = "zigWeld"
- zigWeld.Part0 = zigClone.Paper
- zigWeld.Part1 = zigAnchor
- zigWeld.C0 = CF(0,0,0) * CFANG(RAD(-20),RAD(0),RAD(15))
- zigWeld.C1 = CF(0,0,0) * CFANG(RAD(0),RAD(0),RAD(0))
- zigWeld.Parent = zigClone
- zigClone.Parent = rArm
- currentZig = zigClone
- currentWeld = zigWeld
- local PaperOffsetAmount = zigClone.Paper.Mesh.Scale.y/size*(zigClone.Paper.Size.y/2)
- local PaperOriginalScale = zigClone.Paper.Mesh.Scale.y
- local TobaccyOffsetAmount = zigClone.Tobaccy.Mesh.Scale.y/size*(zigClone.Tobaccy.Size.y/2)
- local TobaccyOriginalScale = zigClone.Tobaccy.Mesh.Scale.y
- local CherryOffsetAmount = zigClone.Cherry.Mesh.Scale.y/size*(zigClone.Cherry.Size.y/2)
- local CherryOriginalScale = zigClone.Cherry.Mesh.Scale.y
- TweenJoint(zigWeld, CF(0,0,-0.22) * CFANG(RAD(-12),RAD(0),RAD(60)), CF(0,0,0), Linear, 0.5 * 1)
- TweenJoint(lWeld, Tool.LeftValue2.Value, CF(0,0,0), Linear, 0.5 * 1)
- TweenJoint(rWeld, Tool.RightValue2.Value, CF(0,0,0), Linear, 0.5 * 1)
- wait(0.5 * 1)
- packClone.Parent = nil
- local lighterClone = game.Lighting.Zigaretenzeug.Lighter:Clone()
- lighterClone.Parent = lArm
- local lighterWeld = Instance.new("Weld")
- lighterWeld.Name = "lighterWeld"
- lighterWeld.Part0 = lighterClone
- lighterWeld.Part1 = lArm
- lighterWeld.C0 = CF(-0.34,-0.53,-1.11) * CFANG(RAD(95),RAD(-8),RAD(180))
- lighterWeld.C1 = CF(0,0,0) --* CFANG(RAD(180),RAD(80),RAD(0))
- lighterWeld.Parent = lighterClone
- lighterClone.Parent = lArm
- TweenJoint(lWeld, Tool.LeftValue3.Value, CF(0,0,0), Linear, 0.5 * 1)
- ---zigWeld.C0 = CF(0,-0.7,-0.9) * CFANG(RAD(75),RAD(-8),RAD(180)) REMEMBER THIS
- wait(0.5 * 1.2)
- lighterClone.Sound:Play()
- wait(0.1)
- lighterClone.GUI.Enabled = true
- heat = 1
- wait(0.5)
- zigClone.Smack.ParticleEmitter.Enabled = true
- zigClone.Cherry.Transparency = 0.1
- currentZig.Paper.Crackle:Play()
- wait(0.7)
- lighterClone.GUI.Enabled = false
- wait(0.2)
- TweenJoint(lWeld, Tool.LeftValue2.Value, CF(0,0,0), Linear, 0.5 * 1)
- wait(0.5 * 1)
- lighterClone:Remove()
- local lShoulderStorageClone = lShoulderStorage:Clone()
- lShoulderStorageClone.Parent = Torso
- lWeld:Remove()
- TweenJoint(rWeld, Tool.RightValue4.Value, CF(0,0,0), Linear, 0.5 * 1)
- TweenJoint(zigWeld, CF(0,0.5,-0.22) * CFANG(RAD(75),RAD(0),RAD(20)), CF(0,0,0) * CFANG(0,0,RAD(20)), Linear, 0.5 * 1)
- pulling = false
- heat = 0.3
- delay(0,function()
- while hasZig and size > minSize and Selected do
- wait(0.1)
- size = size - (1*heat)
- zigClone.Paper.Mesh.Scale = Vector3.new(zigClone.Paper.Mesh.Scale.x, PaperOriginalScale*size/2000, zigClone.Paper.Mesh.Scale.z)
- zigClone.Paper.Mesh.Offset = Vector3.new(zigClone.Paper.Mesh.Offset.x, zigClone.Paper.Mesh.Offset.y + (PaperOffsetAmount*heat), zigClone.Paper.Mesh.Offset.z)
- zigClone.Tobaccy.Mesh.Scale = Vector3.new(zigClone.Tobaccy.Mesh.Scale.x, TobaccyOriginalScale*size/2000, zigClone.Tobaccy.Mesh.Scale.z)
- zigClone.Tobaccy.Mesh.Offset = Vector3.new(zigClone.Tobaccy.Mesh.Offset.x, zigClone.Tobaccy.Mesh.Offset.y + (TobaccyOffsetAmount*heat), zigClone.Tobaccy.Mesh.Offset.z)
- zigClone.Cherry.Mesh.Scale = Vector3.new(zigClone.Cherry.Mesh.Scale.x, CherryOriginalScale*size/2000, zigClone.Cherry.Mesh.Scale.z)
- zigClone.Cherry.Mesh.Offset = Vector3.new(zigClone.Cherry.Mesh.Offset.x, zigClone.Cherry.Mesh.Offset.y + (CherryOffsetAmount*heat), zigClone.Cherry.Mesh.Offset.z)
- if size <= minSize then
- zigWeld:Remove()
- zigClone.Parent = workspace
- hasZig = false
- ready = false
- currentZig.Paper.Crackle:Stop()
- zigAnchor:Remove()
- TweenJoint(rWeld, Tool.RightValue4.Value, CF(0,0,0), Linear, 0.5 * 1)
- --[[local gyro = Instance.new("BodyGyro")
- gyro.Parent = zigClone.Paper]]
- local oldZig = zigClone
- delay(0,function()
- wait(30)
- if oldZig then
- oldZig.Fizzled.Value = true
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- wait(60)
- oldZig:Remove()
- end)
- oldZig.Paper.Touched:connect(function(hit)
- if hit.Name == "Left Leg" or hit.Name == "Right Leg" then
- if oldZig.Fizzled.Value ~= true then
- oldZig.Fizzled.Value = true
- oldZig.Paper.Sound:Play()
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- end
- end)
- wait(0.1)
- lWeld = Instance.new("Weld")
- lWeld.Name = "lWeld"
- lWeld.C0 = lShoulder.C0
- lWeld.C1 = lShoulder.C1
- lWeld.Part0 = Torso
- lWeld.Part1 = lArm
- lShoulder:remove()
- lWeld.Parent = Torso
- GetPack(lWeld,packClone,defaultLArmC0,defaultLArmC1)
- end
- if numberLeft <= 0 then
- Selected = false
- currentWeld:Remove()
- currentZig.Parent = workspace
- packClone.Parent = nil
- hasZig = false
- ready = false
- pulling = false
- drawing = false
- currentZig.Paper.Crackle:Stop()
- local oldZig = currentZig
- oldZig.Paper.CanCollide = true
- local lShoulderStorageClone = lShoulderStorage:Clone()
- lShoulderStorageClone.Parent = Torso
- lWeld:Remove()
- local rShoulderStorageClone = rShoulderStorage:Clone()
- rShoulderStorageClone.Parent = Torso
- rWeld:Remove()
- rArm:findFirstChild("Paper"):Remove()
- delay(0,function()
- wait(30)
- if oldZig then
- oldZig.Fizzled.Value = true
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- wait(60)
- oldZig:Remove()
- end)
- oldZig.Paper.Touched:connect(function(hit)
- if hit.Name == "Left Leg" or hit.Name == "Right Leg" then
- if oldZig.Fizzled.Value ~= true then
- oldZig.Fizzled.Value = true
- oldZig.Paper.Sound:Play()
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- end
- end)
- print("I'm gone!")
- Tool:Remove()
- end
- end
- end)
- elseif hasZig and ready and not pulling and not drawing then
- drawing = true
- TweenJoint(rWeld, Tool.RightValue2.Value, CF(0,0,0), Linear, 0.5 * 1)
- TweenJoint(zigWeld, CF(0,0,-0.22) * CFANG(RAD(-12),RAD(0),RAD(60)), CF(0,0,0), Linear, 0.5 * 1)
- wait(0.5 * 1)
- --currentZig.Paper.Crackle:Play()
- if drawing then
- heat = 2.5
- currentZig.Paper.Crackle.PlaybackSpeed = 3
- currentZig.Paper.Crackle.Volume = 0.4
- end
- mouse.Button1Up:connect(function()
- if hasZig and ready and not pulling then
- drawing = false
- TweenJoint(rWeld, Tool.RightValue4.Value, CF(0,0,0), Linear, 0.5 * 1)
- TweenJoint(zigWeld, CF(0,0.5,-0.22) * CFANG(RAD(75),RAD(0),RAD(20)), CF(0,0,0) * CFANG(0,0,RAD(20)), Linear, 0.5 * 1)
- currentZig.Paper.Crackle.PlaybackSpeed = 1.7
- currentZig.Paper.Crackle.Volume = 0.1
- heat = 0.3
- end
- end)
- end
- end)
- end)
- Tool.Unequipped:connect(function()
- Selected = false
- currentWeld:Remove()
- currentZig.Parent = workspace
- packClone.Parent = nil
- hasZig = false
- ready = false
- pulling = false
- drawing = false
- currentZig.Paper.Crackle:Stop()
- local oldZig = currentZig
- oldZig.Paper.CanCollide = true
- local lShoulderStorageClone = lShoulderStorage:Clone()
- lShoulderStorageClone.Parent = Torso
- lWeld:Remove()
- local rShoulderStorageClone = rShoulderStorage:Clone()
- rShoulderStorageClone.Parent = Torso
- rWeld:Remove()
- rArm:findFirstChild("Paper"):Remove()
- delay(0,function()
- wait(30)
- if oldZig then
- oldZig.Fizzled.Value = true
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- wait(60)
- oldZig:Remove()
- end)
- oldZig.Paper.Touched:connect(function(hit)
- if hit.Name == "Left Leg" or hit.Name == "Right Leg" then
- if oldZig.Fizzled.Value ~= true then
- oldZig.Fizzled.Value = true
- oldZig.Paper.Sound:Play()
- oldZig.Cherry.Material = "Slate"
- oldZig.Cherry.BrickColor = BrickColor.new("Fossil")
- oldZig.Smack.ParticleEmitter.Enabled = false
- end
- end
- end)
- print("I'm unselected!")
- end)
- local heat = 0
- local size = 100
- local minSize = 25
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement