Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- LocalScript4 = Instance.new("LocalScript")
- RemoteEvent5 = Instance.new("RemoteEvent")
- Script6 = Instance.new("Script")
- Tool0.Name = "Paintball Gun"
- Tool0.Parent = mas
- Tool0.TextureId = "rbxasset://Textures/PaintballIcon.png"
- Tool0.Grip = CFrame.new(0, 0.400000006, 0.5, 1, 0, -0, 0, 0, 1, 0, -1, -0)
- Tool0.GripForward = Vector3.new(0, -1, 0)
- Tool0.GripPos = Vector3.new(0, 0.400000006, 0.5)
- Tool0.GripUp = Vector3.new(0, 0, -1)
- Tool0.ToolTip = "see: Paintball! by daxter33"
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.CFrame = CFrame.new(-7.5, 2.5, -10.75, 0, 1, 0, 0, 0, -1, -1, 0, 0)
- Part1.Orientation = Vector3.new(90, 90, 0)
- Part1.Position = Vector3.new(-7.5, 2.5, -10.75)
- Part1.Rotation = Vector3.new(90, 0, -90)
- Part1.Size = Vector3.new(0.5, 5, 3)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.formFactor = Enum.FormFactor.Symmetric
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "rbxasset://fonts/PaintballGun.mesh"
- SpecialMesh2.TextureId = "rbxasset://textures/PaintballGunTex128.png"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- Sound3.Name = "Fire"
- Sound3.Parent = Part1
- Sound3.Pitch = 3
- Sound3.PlaybackSpeed = 3
- Sound3.SoundId = "rbxassetid://1240222815"
- LocalScript4.Parent = Tool0
- table.insert(cors,sandbox(LocalScript4,function()
- end))
- RemoteEvent5.Name = "paintball"
- RemoteEvent5.Parent = Tool0
- Script6.Parent = Tool0
- table.insert(cors,sandbox(Script6,function()
- --By Rufus14, based on daxter's Paintball! game
- players = game:GetService("Players")
- runservice = game:GetService("RunService")
- owner = nil
- character = nil
- tool = script.Parent
- handle = tool.Handle
- remote = tool:WaitForChild("paintball")
- equipped = false
- firesound = handle.Fire
- tool.Grip = tool.Grip * CFrame.new(0,0,-0.5)
- --
- remote.OnServerEvent:connect(function(plr, what, pos)
- if plr == owner then
- if what == "shoot" then
- firesound:Play()
- local paint = Instance.new("UnionOperation", character.Head)
- local brickmesh = Instance.new("BlockMesh", paint)
- paint.Size = Vector3.new(0.1,0.1, 4)
- paint.BrickColor = character.Torso.BrickColor
- paint.Anchored = true
- paint.CanCollide = false
- paint.CFrame = handle.CFrame * CFrame.new(0,-4.5,0)
- paint.CFrame = CFrame.new(paint.Position, pos)
- coroutine.wrap(function()
- local hitanything = false
- local turn = 0
- local hitafter = nil
- local positionafter = nil
- local surfaceafter = nil
- local howmuch = 0
- local function afterhit(WHO)
- local hum = WHO:findFirstChildOfClass("Humanoid")
- local dude = game:GetService("Players"):GetPlayerFromCharacter(WHO)
- if hum and dude then
- if owner.TeamColor.Name ~= dude.TeamColor.Name then
- hum.Health = hum.Health - 15
- elseif owner.TeamColor.Name ~= owner.Neutral == true then
- hum.Health = hum.Health - 15
- end
- end
- end
- while not hitanything and runservice.Stepped:wait() and howmuch < 500 do
- howmuch = howmuch + 1
- local ray = Ray.new(paint.Position, paint.CFrame.lookVector * 7)
- local hit, position, surface = workspace:FindPartOnRayWithIgnoreList(ray, {character})
- if hit then
- hitanything = true
- hitafter = hit
- positionafter = position
- surfaceafter = surface
- local dude = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
- if hit.Parent:findFirstChildOfClass("Humanoid") and dude then
- if dude.TeamColor ~= owner.TeamColor then
- afterhit(hit.Parent)
- end
- elseif hit.Parent.Parent:findFirstChildOfClass("Humanoid") and dude then
- if dude.TeamColor ~= owner.TeamColor then
- afterhit(hit.Parent.Parent)
- end
- end
- end
- paint.CFrame = paint.CFrame * CFrame.new(0,0,-7)
- if turn < 90 then
- turn = turn + 0.01
- paint.CFrame = paint.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-turn),0,0)
- end
- end
- if hitanything then
- if hitafter.Name ~= "PaintballSplat" then
- local paintballhahajokegetit = Instance.new("UnionOperation", character.Head)
- local ballmesh = Instance.new("SpecialMesh", paintballhahajokegetit)
- ballmesh.MeshType = "Sphere"
- paintballhahajokegetit.Size = Vector3.new(0.25,0.25,0.25)
- paintballhahajokegetit.Name = "PaintballSplat"
- paintballhahajokegetit.BrickColor = character.Torso.BrickColor
- paintballhahajokegetit.CFrame = CFrame.new(positionafter, positionafter + surfaceafter)
- paintballhahajokegetit:BreakJoints()
- local weldball = Instance.new("Weld", paintballhahajokegetit)
- weldball.C0 = hitafter.CFrame:toObjectSpace(paintballhahajokegetit.CFrame)
- weldball.Part0 = hitafter
- weldball.Part1 = paintballhahajokegetit
- game.Debris:AddItem(paintballhahajokegetit, 10)
- end
- end
- paint:destroy()
- end)()
- end
- end
- end)
- local oldc = owner.Character.Torso.Color
- tool.Equipped:connect(function()
- owner = players:GetPlayerFromCharacter(tool.Parent)
- character = owner.Character
- --
- local torso = character.Torso
- if owner.Neutral then
- character.Torso.BrickColor = BrickColor.new("White")
- else
- character.Torso.BrickColor = owner.TeamColor
- end
- local rootpart = character.HumanoidRootPart
- -----
- if character:findFirstChildOfClass("Pants") then
- local lastid = Instance.new("StringValue", character:findFirstChildOfClass("Pants"))
- lastid.Value = character:findFirstChildOfClass("Pants").PantsTemplate
- lastid.Name = "lastid"
- character:findFirstChildOfClass("Pants").PantsTemplate = ""
- end
- if character:findFirstChildOfClass("Shirt") then
- local lastid = Instance.new("StringValue", character:findFirstChildOfClass("Shirt"))
- lastid.Value = character:findFirstChildOfClass("Shirt").ShirtTemplate
- lastid.Name = "lastid"
- character:findFirstChildOfClass("Shirt").ShirtTemplate = ""
- end
- for i,v in pairs(character:GetChildren()) do
- if v.ClassName == "Accessory" or v.ClassName == "Hat" then
- if v:findFirstChild("Handle") then
- v:findFirstChild("Handle").Transparency = 1
- end
- end
- end
- ---
- local blockmesh = Instance.new("BlockMesh", torso)
- blockmesh.Name = "PaintballBlockMesh"
- -----
- local lastcolor = Instance.new("StringValue", character["Right Arm"])
- lastcolor.Value = tostring(character["Right Arm"].BrickColor)
- lastcolor.Name = "lastcolor"
- character["Right Arm"].BrickColor = BrickColor.Black()
- --
- local lastcolor = Instance.new("StringValue", character["Left Arm"])
- lastcolor.Value = tostring(character["Left Arm"].BrickColor)
- lastcolor.Name = "lastcolor"
- character["Left Arm"].BrickColor = BrickColor.Black()
- --
- local lastcolor = Instance.new("StringValue", character["Left Leg"])
- lastcolor.Value = tostring(character["Left Leg"].BrickColor)
- lastcolor.Name = "lastcolor"
- character["Left Leg"].BrickColor = BrickColor.Black()
- --
- local lastcolor = Instance.new("StringValue", character["Right Leg"])
- lastcolor.Value = tostring(character["Right Leg"].BrickColor)
- lastcolor.Name = "lastcolor"
- character["Right Leg"].BrickColor = BrickColor.Black()
- --
- local lastcolor = Instance.new("StringValue", character.Head)
- lastcolor.Value = tostring(character.Head.BrickColor)
- lastcolor.Name = "lastcolor"
- character.Head.BrickColor = BrickColor.new("Bright yellow")
- ---
- local stud = Instance.new("Decal", character["Right Arm"])
- stud.Texture = "http://www.roblox.com/asset/?id=133864166"
- stud.Face = "Top"
- stud.Name = "PaintballStud"
- ---
- local stud = Instance.new("Decal", character["Left Arm"])
- stud.Texture = "http://www.roblox.com/asset/?id=133864166"
- stud.Face = "Top"
- stud.Name = "PaintballStud"
- --
- local stud = Instance.new("Decal", character["Right Leg"])
- stud.Texture = "http://www.roblox.com/asset/?id=631564059"
- stud.Face = "Bottom"
- stud.Name = "PaintballStud"
- ---
- local stud = Instance.new("Decal", character["Left Leg"])
- stud.Texture = "http://www.roblox.com/asset/?id=631564059"
- stud.Face = "Bottom"
- stud.Name = "PaintballStud"
- ---
- local mask = Instance.new("Part", character)
- mask.Size = Vector3.new(1,1,1)
- mask.CanCollide = false
- mask.Name = "PaintballMask"
- mask:BreakJoints()
- local maskweld = Instance.new("Weld", mask)
- maskweld.Part0 = character.Head
- maskweld.Part1 = mask
- local maskmesh = Instance.new("SpecialMesh", mask)
- maskmesh.MeshId = "http://www.roblox.com/asset/?id=9253927"
- maskmesh.TextureId = "http://www.roblox.com/asset/?id=9253896"
- --
- local humanoidrootpart = Instance.new("Weld", owner.Character.HumanoidRootPart)
- humanoidrootpart.Part0 = owner.Character.HumanoidRootPart
- humanoidrootpart.Part1 = owner.Character.Torso
- humanoidrootpart.Name = "HumanoidRootPartWeldpaintb"
- humanoidrootpart.C0 = CFrame.fromEulerAnglesXYZ(0,-math.pi/4,0)
- local leftarm = Instance.new("Weld", owner.Character.Torso)
- leftarm.Part0 = owner.Character.Torso
- leftarm.Part1 = owner.Character["Left Arm"]
- leftarm.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2,0,math.pi/4) * CFrame.new(0,-1,0)
- leftarm.Name = "LeftArmWeldpaintb"
- local rightarm = Instance.new("Weld", owner.Character.Torso)
- rightarm.Part0 = owner.Character.Torso
- rightarm.Part1 = owner.Character["Right Arm"]
- rightarm.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi/2,0,-math.pi/4) * CFrame.new(0,-1,0)
- rightarm.Name = "RightArmWeldpaintb"
- local head = Instance.new("Weld", owner.Character.Torso)
- head.Part0 = owner.Character.Torso
- head.Part1 = owner.Character.Head
- head.C0 = CFrame.new(0,1.5,0) * CFrame.fromEulerAnglesXYZ(0,math.pi/4,0)
- head.Name = "HeadWeldpaintb"
- end)
- tool.Unequipped:connect(function()
- character.Torso.Color = oldc
- if character.Torso:findFirstChild("PaintballBlockMesh") then
- character.Torso:findFirstChild("PaintballBlockMesh"):destroy()
- end
- if character.Torso:findFirstChild("LeftArmWeldpaintb") then
- character.Torso:findFirstChild("LeftArmWeldpaintb"):destroy()
- end
- if character.Torso:findFirstChild("RightArmWeldpaintb") then
- character.Torso:findFirstChild("RightArmWeldpaintb"):destroy()
- end
- if character.Torso:findFirstChild("HeadWeldpaintb") then
- character.Torso:findFirstChild("HeadWeldpaintb"):destroy()
- end
- if character:findFirstChild("HumanoidRootPart") then
- if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldpaintb") then
- character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldpaintb"):destroy()
- end
- end
- if character:findFirstChild("PaintballMask") then
- character:findFirstChild("PaintballMask"):destroy()
- end
- if character:findFirstChildOfClass("Pants") then
- character:findFirstChildOfClass("Pants").PantsTemplate = character:findFirstChildOfClass("Pants").lastid.Value
- end
- if character:findFirstChildOfClass("Shirt") then
- character:findFirstChildOfClass("Shirt").ShirtTemplate = character:findFirstChildOfClass("Shirt").lastid.Value
- end
- for i,v in pairs(character:GetChildren()) do
- if v.ClassName == "Accessory" or v.ClassName == "Hat" then
- if v:findFirstChild("Handle") then
- v:findFirstChild("Handle").Transparency = 0
- end
- end
- end
- for i,v in pairs(character:GetDescendants()) do
- if v.Name == "lastcolor" then
- v.Parent.BrickColor = BrickColor.new(v.Value)
- v:destroy()
- end
- if v.Name == "PaintballStud" then
- v:destroy()
- end
- end
- end)
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = owner.Character
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- NLS([[
- --By Rufus14
- players = game:GetService("Players")
- runservice = game:GetService("RunService")
- owner = players.LocalPlayer
- character = owner.Character
- mouse = owner:GetMouse()
- tool = script.Parent
- handle = tool.Handle
- remote = tool:WaitForChild("paintball")
- equipped = false
- --
- tool.Activated:connect(function()
- local playerhumanoid = character:findFirstChildOfClass("Humanoid")
- remote:FireServer("shoot", playerhumanoid.TargetPoint)
- end)
- --
- tool.Equipped:connect(function()
- equipped = true
- owner = players.LocalPlayer
- character = owner.Character
- local playerhumanoid = character:findFirstChildOfClass("Humanoid")
- local rootpart = character:findFirstChild("HumanoidRootPart")
- playerhumanoid.AutoRotate = false
- coroutine.wrap(function()
- while equipped and runservice.RenderStepped:wait() do
- if rootpart then
- rootpart.CFrame = rootpart.CFrame:lerp(CFrame.new(rootpart.Position, Vector3.new(mouse.Hit.p.x,rootpart.Position.y,mouse.Hit.p.z)),0.4)
- end
- end
- end)()
- end)
- tool.Unequipped:connect(function()
- local playerhumanoid = character:findFirstChildOfClass("Humanoid")
- playerhumanoid.AutoRotate = true
- equipped = false
- end)
- ]], Tool0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement