Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- 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")
- Part1 = Instance.new("Part")
- Sparkles2 = Instance.new("Sparkles")
- BoolValue3 = Instance.new("BoolValue")
- PointLight4 = Instance.new("PointLight")
- Animation5 = Instance.new("Animation")
- Animation6 = Instance.new("Animation")
- BoolValue7 = Instance.new("BoolValue")
- BoolValue8 = Instance.new("BoolValue")
- StringValue9 = Instance.new("StringValue")
- LocalScript10 = Instance.new("LocalScript")
- Animation11 = Instance.new("Animation")
- Animation12 = Instance.new("Animation")
- Animation13 = Instance.new("Animation")
- IntValue14 = Instance.new("IntValue")
- Script15 = Instance.new("Script")
- ScreenGui16 = Instance.new("ScreenGui")
- Frame17 = Instance.new("Frame")
- Frame18 = Instance.new("Frame")
- Frame19 = Instance.new("Frame")
- TextLabel20 = Instance.new("TextLabel")
- Script21 = Instance.new("Script")
- Script22 = Instance.new("Script")
- Script23 = Instance.new("Script")
- Tool0.Name = "RSaber"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=202581977"
- Tool0.GripForward = Vector3.new(4.37113883e-08, -0, -1)
- Tool0.GripPos = Vector3.new(-4.80825264e-08, -0.900000036, -2.10175408e-15)
- Tool0.GripRight = Vector3.new(1, -4.37113883e-08, 4.37113883e-08)
- Tool0.GripUp = Vector3.new(4.37113883e-08, 1, 1.91068547e-15)
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.Transparency = 1
- Part1.Rotation = Vector3.new(-90, 0, -180)
- Part1.CanCollide = false
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(0.200000003, 6, 0.899999976)
- Part1.CFrame = CFrame.new(47.3373795, 1.99821472, -8.96564388, -1, 4.37113883e-08, -4.37113883e-08, -4.37113883e-08, 6.12323426e-17, 1, 4.37113883e-08, 1, 1.84945303e-15)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Position = Vector3.new(47.3373795, 1.99821472, -8.96564388)
- Part1.Orientation = Vector3.new(-90, -180, 0)
- Sparkles2.Parent = Part1
- Sparkles2.Color = Color3.new(1.77083, 10.2, 0)
- Sparkles2.Enabled = false
- Sparkles2.SparkleColor = Color3.new(1, 1, 0)
- Sparkles2.Color = Color3.new(1.77083, 10.2, 0)
- BoolValue3.Name = "Blockable"
- BoolValue3.Parent = Part1
- BoolValue3.Value = true
- PointLight4.Parent = Part1
- PointLight4.Color = Color3.new(1, 0, 0)
- PointLight4.Range = 12
- PointLight4.Color = Color3.new(1, 0, 0)
- Animation5.Name = "LeftSlash"
- Animation5.Parent = Tool0
- Animation5.AnimationId = "http://www.roblox.com/Asset?ID=74894663"
- Animation6.Name = "Equip"
- Animation6.Parent = Tool0
- Animation6.AnimationId = "http://www.roblox.com/Asset?ID=94160581"
- BoolValue7.Name = "MouseDown"
- BoolValue7.Parent = Tool0
- BoolValue8.Name = "Reloading"
- BoolValue8.Parent = Tool0
- StringValue9.Name = "RunAnim"
- StringValue9.Parent = Tool0
- LocalScript10.Parent = Tool0
- table.insert(cors,sandbox(LocalScript10,function()
- --Made by Stickmasterluke
- sp=script.Parent
- function waitfor(a,b)
- while a:FindFirstChild(b)==nil do
- a.ChildAdded:wait()
- end
- return a:FindFirstChild(b)
- end
- reloading=waitfor(sp,"Reloading")
- down=waitfor(sp,"MouseDown")
- runanim=waitfor(sp,"RunAnim")
- animspeed=2.4 --lower number is slower
- equipspeed=1.5
- originalgrip=CFrame.new(0,0,-1.1,0,0,1,1,0,0,0,1,0)
- currentgrip=originalgrip
- function swordUp()
- currentgrip=originalgrip
- sp.Grip=currentgrip
- end
- function swordOut()
- currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
- sp.Grip=currentgrip
- end
- function spinsword(spintime)
- delay(0,function()
- local startspin=tick()
- local endspin=startspin+spintime
- while tick()<endspin do
- sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
- wait()
- end
- sp.Grip=currentgrip
- end)
- end
- function update(mouse)
- if mouse~=nil then
- if reloading.Value then
- mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
- else
- mouse.Icon="rbxasset://textures\\GunCursor.png"
- end
- end
- end
- runanim.Changed:connect(function()
- local h=sp.Parent:FindFirstChild("Humanoid")
- local t=sp.Parent:FindFirstChild("Torso")
- local anim=sp:FindFirstChild(runanim.Value)
- if anim and t and h then
- local theanim=h:LoadAnimation(anim)
- if theanim and h.Health>0 then
- theanim:Play(nil,nil,animspeed)
- end
- end
- end)
- function Equipped(mouse)
- if mouse~=nil then
- update(mouse)
- reloading.Changed:connect(function()
- update(mouse)
- end)
- mouse.Button1Down:connect(function()
- down.Value=true
- end)
- mouse.Button1Up:connect(function()
- down.Value=false
- end)
- local h=sp.Parent:FindFirstChild("Humanoid")
- local t=sp.Parent:FindFirstChild("Torso")
- if t and h then
- local equipanim=sp:FindFirstChild("Equip")
- if equipanim~=nil then
- local EquipAnim=h:LoadAnimation(equipanim)
- if EquipAnim and h.Health>0 then
- EquipAnim:Play(nil,nil,equipspeed)
- end
- end
- local holdanim=sp:FindFirstChild("Hold")
- if holdanim~=nil then
- if HoldAnim then
- HoldAnim:Stop()
- end
- HoldAnim=h:LoadAnimation(holdanim)
- if HoldAnim and h.Health>0 then
- HoldAnim:Play()
- end
- end
- end
- end
- end
- function Unequipped()
- down.Value=false
- if HoldAnim then
- HoldAnim:Stop()
- end
- end
- sp.Equipped:connect(Equipped)
- sp.Unequipped:connect(Unequipped)
- end))
- Animation11.Name = "Hold"
- Animation11.Parent = Tool0
- Animation11.AnimationId = "http://www.roblox.com/Asset?ID=96559165"
- Animation12.Name = "Stab1"
- Animation12.Parent = Tool0
- Animation12.AnimationId = "http://www.roblox.com/Asset?ID=96559159"
- Animation13.Name = "Stab2"
- Animation13.Parent = Tool0
- Animation13.AnimationId = "http://www.roblox.com/Asset?ID=96559161"
- IntValue14.Name = "WeaponSpeed"
- IntValue14.Parent = Tool0
- IntValue14.Value = 98
- Script15.Parent = Tool0
- table.insert(cors,sandbox(Script15,function()
- --Made by Stickmasterluke
- sp=script.Parent
- damage=50 -- +/- 10%
- damagewindow=1 --after clicking, how long does the player have to hit the opponent wioth their weapon to deal damage
- swingrate=.2
- clashsounds={163064102,185722889}
- swooshsounds={165344304,145486992}
- hitsounds={138079201,142491739}
- anims={"Stab1","Stab2","LeftSlash"}
- ready=false
- equipped=false
- rate=1/30
- lastswing=0
- function waitfor(a,b)
- while a:FindFirstChild(b)==nil do
- a.ChildAdded:wait()
- end
- return a:FindFirstChild(b)
- end
- reloading=waitfor(sp,"Reloading")
- down=waitfor(sp,"MouseDown")
- runanim=waitfor(sp,"RunAnim")
- sparkles=waitfor(sp.Handle,"Sparkles")
- debris=game:getService("Debris")
- weaponhud=waitfor(sp,"WeaponHud")
- weaponnametag=waitfor(weaponhud,"WeaponName")
- guibar=waitfor(weaponhud,"Bar")
- guibarfill=waitfor(guibar,"Fill")
- weaponnametag.Text=sp.Name
- function runsound(id,volume)
- local volume=volume or 1
- local sound=Instance.new("Sound")
- sound.Looped=false
- sound.Pitch=1.5
- sound.SoundId="http://www.roblox.com/asset/?id="..tostring(id)
- sound.PlayOnRemove=false
- sound.Volume=volume
- debris:AddItem(sound,3)
- sound.Parent=sp.Handle
- wait()
- sound:Play()
- end
- function billboard(pos,text,time,color)
- local pos=pos or Vector3.new(0,0,0)
- local text=text or "Hello World!"
- local time=time or 2
- local color=color or Color3.new(1,0,0)
- local pos=pos+Vector3.new(0,5,0)
- local ep=Instance.new("Part")
- ep.Name="Effect"
- ep.formFactor="Custom"
- ep.Size=Vector3.new(0,0,0)
- ep.TopSurface="Smooth"
- ep.BottomSurface="Smooth"
- ep.CFrame=CFrame.new(pos)
- ep.Anchored=true
- ep.CanCollide=false
- ep.Transparency=1
- local bb=Instance.new("BillboardGui")
- bb.Size=UDim2.new(3,0,3,0)
- bb.Adornee=ep
- bb.Enabled = false
- local tl=Instance.new("TextLabel")
- tl.BackgroundTransparency=1
- tl.Size=UDim2.new(1,0,1,0)
- tl.Text=text
- tl.TextColor3=color
- tl.TextScaled=true
- tl.Font="ArialBold"
- tl.Visible = false
- tl.Parent=bb
- bb.Parent=ep
- debris:AddItem(ep,time+.1)
- ep.Parent=game.Workspace
- delay(0,function()
- local frames=time/rate
- for frame=1,frames do
- wait(rate)
- local percent=frame/frames
- ep.CFrame=CFrame.new(pos)+Vector3.new(0,5*percent,0)
- tl.TextTransparency=percent
- end
- ep:remove()
- end)
- end
- function makeblood(part)
- if part then
- local b=Instance.new("Part")
- b.BrickColor=BrickColor.new("Neon orange")
- b.formFactor="Custom"
- b.Transparency=math.random(0,1)*.5
- if math.random()<.5 then
- b.CanCollide=false
- else
- b.CanCollide=true
- end
- b.TopSurface="Smooth"
- b.BottomSurface="Smooth"
- b.Size=Vector3.new(.2*math.random(1,5),.2*math.random(1,5),.2*math.random(1,5))
- b.Velocity=part.Velocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*30)
- b.RotVelocity=part.RotVelocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*20)
- b.CFrame=part.CFrame*CFrame.new((math.random()-.5)*3,(math.random()-.5)*3,(math.random()-.5)*3)*CFrame.Angles(math.pi*2*math.random(),math.pi*2*math.random(),math.pi*2*math.random())
- debris:AddItem(b,math.random()*4)
- b.Parent=game.Workspace
- local burnbaby = Instance.new("Fire")
- burnbaby.Parent = b
- burnbaby.Size = 2
- burnbaby.Heat = 25
- end
- end
- sp.Handle.Touched:connect(function(hit)
- if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
- if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
- ready=false
- runsound(clashsounds[math.random(1,#clashsounds)])
- sparkles.Enabled=true
- delay(.2,function()
- sparkles.Enabled=false
- end)
- billboard(sp.Handle.Position,"Block",2,Color3.new(1,1,0))
- end
- local mh=sp.Parent:FindFirstChild("Humanoid")
- local eh=hit.Parent:FindFirstChild("Humanoid")
- local ra=sp.Parent:FindFirstChild("Right Arm")
- local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
- if mh and eh and eh~=mh and mh.Health>0 and eh.Health>0 and ra and plr~=nil then
- if not plr.Neutral then
- local eplr=game.Players:GetPlayerFromCharacter(eh.Parent)
- if eplr~=nil and eplr.Neutral==false and eplr.TeamColor==plr.TeamColor then
- return --No team killing
- end
- end
- ready=false
- for i,v in ipairs(eh:GetChildren()) do
- if v.Name=="creator" then
- v:remove()
- end
- end
- local creator=Instance.new("ObjectValue")
- creator.Name="creator"
- creator.Value=plr
- creator.Parent=eh
- debris:AddItem(creator,1)
- local localdamage=math.floor(damage*(.9+(math.random()*.2)))
- eh:TakeDamage(localdamage)
- billboard(hit.Position,"-"..tostring(localdamage))
- runsound(hitsounds[math.random(1,#hitsounds)])
- local bloodeffects=math.ceil(localdamage/10)
- for i=1,math.random(bloodeffects-1,bloodeffects+1) do
- --[[if math.random()<.5 then
- makeblood(sp.Handle)
- else]]
- makeblood(hit)
- --end
- end
- end
- end
- end)
- function Activate()
- if equipped and (tick()-lastswing)>=swingrate then
- ready=true
- reloading.Value=true
- --script.Parent.Parent.Humanoid.WalkSpeed = 32
- runsound(swooshsounds[math.random(1,#swooshsounds)],.5)
- newanim=anims[math.random(1,#anims)]
- while newanim==runanim.Value do
- newanim=anims[math.random(1,#anims)]
- end
- runanim.Value=newanim
- lastswing=tick()
- updategui()
- wait(swingrate)
- reloading.Value=false
- --script.Parent.Parent.Humanoid.WalkSpeed = 16
- if down.Value then
- Activate()
- end
- end
- end
- down.Changed:connect(function()
- if down.Value then
- Activate()
- end
- end)
- function updategui()
- local swingpercent=math.min((tick()-lastswing)/swingrate,1)
- if swingpercent<.5 then --fade from red to yellow then to green
- guibarfill.BackgroundColor3=Color3.new(1,swingpercent*2,0)
- else
- guibarfill.BackgroundColor3=Color3.new(1-((swingpercent-.5)/.5),1,0)
- end
- guibarfill.Size=UDim2.new(swingpercent,0,1,0)
- end
- sp.Equipped:connect(function(mouse)
- lastswing=tick()
- updategui()
- reloading.Value=true
- ready=false
- equipped=true
- delay(0,function() --HAAB (Hacking around a bug)
- local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
- if plr~=nil then
- local plrgui=plr:FindFirstChild("PlayerGui")
- if plrgui~=nil and weaponhud~=nil then
- weaponhud.Parent=plrgui
- while equipped do
- updategui()
- wait(rate)
- end
- end
- end
- end)
- wait(swingrate)
- reloading.Value=false
- if down.Value then
- Activate()
- end
- end)
- sp.Unequipped:connect(function()
- ready=false
- equipped=false
- delay(0,function() --HAAB
- weaponhud.Parent=sp
- end)
- end)
- end))
- ScreenGui16.Name = "WeaponHud"
- ScreenGui16.Parent = Tool0
- Frame17.Name = "Bar"
- Frame17.Parent = ScreenGui16
- Frame17.Size = UDim2.new(0, 200, 0, 40)
- Frame17.Style = Enum.FrameStyle.RobloxRound
- Frame17.Position = UDim2.new(0.5, -100, 1, -160)
- Frame17.Visible = false
- Frame17.ZIndex = 4
- Frame18.Name = "Fill"
- Frame18.Parent = Frame17
- Frame18.Size = UDim2.new(1, 0, 1, 0)
- Frame18.BackgroundColor3 = Color3.new(0, 1, 0)
- Frame18.BorderSizePixel = 0
- Frame18.ZIndex = 5
- Frame19.Name = "Backing"
- Frame19.Parent = Frame17
- Frame19.Size = UDim2.new(1, 0, 1, 0)
- Frame19.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame19.BorderSizePixel = 0
- Frame19.ZIndex = 4
- TextLabel20.Name = "WeaponName"
- TextLabel20.Parent = ScreenGui16
- TextLabel20.Transparency = 1
- TextLabel20.Size = UDim2.new(0, 400, 0, 20)
- TextLabel20.Text = "Dagger"
- TextLabel20.Position = UDim2.new(0.5, -200, 1, -185)
- TextLabel20.Visible = false
- TextLabel20.BackgroundTransparency = 1
- TextLabel20.BorderSizePixel = 0
- TextLabel20.ZIndex = 4
- TextLabel20.ClipsDescendants = true
- TextLabel20.Font = Enum.Font.ArialBold
- TextLabel20.FontSize = Enum.FontSize.Size18
- TextLabel20.TextColor3 = Color3.new(0, 0, 0)
- TextLabel20.TextStrokeColor3 = Color3.new(0.698039, 0.698039, 0.698039)
- TextLabel20.TextTransparency = 0.20000000298023
- Script21.Name = "Poison"
- Script21.Parent = Tool0
- Script21.Disabled = true
- table.insert(cors,sandbox(Script21,function()
- function Poison()
- local character = script.Parent
- local humanoid = character:FindFirstChild("Humanoid")
- local burnbaby = Instance.new("Fire")
- burnbaby.Parent = script.Parent.Torso
- burnbaby.Heat = 25
- burnbaby.Size = 12.5
- if (character:FindFirstChild("ForceField") ~= nil) then return end
- local childs = character:GetChildren()
- local colors = {}
- for i=1,#childs do
- if (childs[i].className == "Part") then
- colors[i] = childs[i].BrickColor
- childs[i].BrickColor = BrickColor.new(26)
- end
- end
- wait(1)
- for i=1,#childs do
- if (childs[i].className == "Part") then
- childs[i].BrickColor = colors[i]
- end
- end
- --tagHumanoid(humanoid, attacker)
- humanoid:TakeDamage(humanoid.MaxHealth / 8)
- wait(1)
- --untagHumanoid(humanoid)
- end
- for i=1,5 do
- Poison()
- wait(.2)
- end
- script.Parent = nil
- end))
- Script22.Name = "SwordScript"
- Script22.Parent = Tool0
- table.insert(cors,sandbox(Script22,function()
- -------- OMG HAX
- r = game:service("RunService")
- local damage = 5
- local slash_damage = 10
- local lunge_damage = 20
- sword = script.Parent.Handle
- Tool = script.Parent
- local SlashSound = Instance.new("Sound")
- SlashSound.SoundId = "http://www.roblox.com/asset/?id=165344304"
- SlashSound.Parent = sword
- SlashSound.Volume = .7
- SlashSound.Pitch = .7
- local LungeSound = Instance.new("Sound")
- LungeSound.SoundId = "http://www.roblox.com/asset/?id=186112111"
- LungeSound.Parent = sword
- LungeSound.Volume = .6
- LungeSound.Pitch = .8
- local UnsheathSound = Instance.new("Sound")
- UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=145486992"
- UnsheathSound.Parent = sword
- UnsheathSound.Volume = 1
- UnsheathSound.Pitch = .7
- function Poison(character, attacker)
- if (character:FindFirstChild("ForceField") ~= nil) then return end
- if (character:FindFirstChild("Poison") == nil ) then
- local s = script.Parent.Poison:clone()
- s.Disabled = false
- s.Parent = character
- end
- end
- function blow(hit)
- local humanoid = hit.Parent:findFirstChild("Humanoid")
- local vCharacter = Tool.Parent
- local vPlayer = game.Players:playerFromCharacter(vCharacter)
- local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
- if humanoid~=nil and humanoid ~= hum and hum ~= nil then
- -- final check, make sure sword is in-hand
- local right_arm = vCharacter:FindFirstChild("Right Arm")
- if (right_arm ~= nil) then
- local joint = right_arm:FindFirstChild("RightGrip")
- if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
- Poison(humanoid.Parent, attacker)
- tagHumanoid(humanoid, vPlayer)
- humanoid:TakeDamage(damage)
- wait(1)
- untagHumanoid(humanoid)
- end
- end
- end
- end
- function tagHumanoid(humanoid, player)
- local creator_tag = Instance.new("ObjectValue")
- creator_tag.Value = player
- creator_tag.Name = "creator"
- creator_tag.Parent = humanoid
- end
- function untagHumanoid(humanoid)
- if humanoid ~= nil then
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- tag.Parent = nil
- end
- end
- end
- function attack()
- damage = slash_damage
- SlashSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Slash"
- anim.Parent = Tool
- script.Parent.Parent.Humanoid.WalkSpeed = 32
- wait(.5)
- script.Parent.Parent.Humanoid.WalkSpeed = 16
- end
- function lunge()
- damage = lunge_damage
- LungeSound:play()
- local anim = Instance.new("StringValue")
- anim.Name = "toolanim"
- anim.Value = "Lunge"
- anim.Parent = Tool
- script.Parent.Parent.Humanoid.WalkSpeed = 32
- wait(.5)
- script.Parent.Parent.Humanoid.WalkSpeed = 16
- local force = Instance.new("BodyVelocity")
- force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
- force.Parent = Tool.Parent.Torso
- wait(.25)
- swordOut()
- wait(.25)
- force.Parent = nil
- wait(.5)
- swordUp()
- damage = slash_damage
- end
- function swordUp()
- Tool.GripForward = Vector3.new(0, 0, -1)
- Tool.GripRight = Vector3.new(1, -0, 0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- end
- function swordOut()
- Tool.GripForward = Vector3.new(0, 0, -1)
- Tool.GripRight = Vector3.new(1, -0, 0)
- Tool.GripUp = Vector3.new(0, 1, 0)
- end
- function swordAcross()
- -- parry
- end
- Tool.Enabled = true
- local last_attack = 0
- function onActivated()
- if not Tool.Enabled then
- return
- end
- Tool.Enabled = false
- local character = Tool.Parent;
- local humanoid = character.Humanoid
- if humanoid == nil then
- print("Humanoid not found")
- return
- end
- t = r.Stepped:wait()
- if (t - last_attack < 2) then
- lunge()
- else
- attack()
- end
- last_attack = t
- --wait(.5)
- Tool.Enabled = true
- end
- function onEquipped()
- UnsheathSound:play()
- end
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:connect(onEquipped)
- connection = sword.Touched:connect(blow)
- end))
- Script23.Name = "UltimateWeld"
- Script23.Parent = Tool0
- table.insert(cors,sandbox(Script23,function()
- --DO NOT USE BOTH WELDING SCRIPTS PROVIDED BY THIS MODEL
- --The regular script is recommended
- --[[
- Prevents welds from breaking/transforming when player uses the tool
- This recreates the EXACT weld every time
- This also prevents lag build up by clearing old welds, the tradition weld script just keeps making new
- ones, which can lead to weapons have crazy amounts of welds that dont work (I saw 6000 in a weapon once)
- ]]
- --[[Usage
- 1. Remove Old welding script (optional, only if updating a weapon and that weapon does not rely on that script)
- 2. Anchor all parts of tool and put inside of a tool object
- 3. Place this script in that tool (make sure you do this AFTER step 2, otherwise it may fail)
- 4. Treat like normal tool, nothing special has to be done with it
- ]]
- --[[The local script included in this model can only be used if
- 1. The weapon is being placed in the players backpack first (i.e. the weapon is in starterpack and moves to player backpack)
- OR
- 2. The weapon is previously welded (weapon can be placed in workspace and picked up then)
- ]]
- repeat wait() until script.Parent:FindFirstChild("Handle")
- local welds={}
- function ClearOldWelds(tbl)
- for _,v in pairs(tbl) do
- if v:IsA('Weld') then
- v:Destroy()
- end
- end
- end
- function Equipped()
- local handle=script.Parent:FindFirstChild('Handle')
- if not handle then return end
- local tble=handle:GetChildren()
- for _,v in pairs(script.Parent:GetChildren()) do
- if v:IsA('BasePart') and v~=handle then
- local c1
- for _1,v1 in pairs(welds) do
- if _1==v then
- c1=v1
- break
- end
- end
- if not c1 then
- welds[v]=v.CFrame:inverse()*handle.CFrame
- v.Anchored=false
- c1=welds[v]
- end
- local weld=Instance.new('Weld')
- weld.Part0=handle
- weld.Part1=v
- weld.C0=CFrame.new()
- weld.C1=c1
- weld.Parent=handle
- end
- end
- ClearOldWelds(tble)
- handle.Anchored=false
- end
- Equipped()
- script.Parent.Equipped:connect(Equipped)
- --Made by DonnyTheDemented
- end))
- 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