Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Talon")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --[[
- Script Version 1
- CocaCola on steroids!
- Script by DarkShadow6
- --]]
- if script == nil then return end
- Player = game.Players:FindFirstChild("zombieslayerwtf")
- Name = "Pepsi"
- selected = false
- Button1Down = false
- canUse = true
- function makeParts(format)
- local bottle = Instance.new("Model")
- bottle.Name = Name
- bottle.Parent = Player.Character
- local pm = Instance.new("Part")
- pm.Name = "Handle"
- pm.FormFactor = "Custom"
- pm.Size = Vector3.new(1, 1, 1)
- pm.BrickColor = BrickColor.new("Medium stone grey")
- pm.Reflectance = 0.2
- pm.Locked = true
- pm.TopSurface = 0
- pm.BottomSurface = 0
- pm.Parent = bottle
- local m = Instance.new("CylinderMesh")
- m.Scale = Vector3.new(0.8, 1.1, 0.8)
- m.Parent = pm
- local d = Instance.new("Decal")
- d.Texture = "http://www.roblox.com/Asset/?id=34399263"
- d.Parent = pm
- local w = Instance.new("Weld")
- w.Part0 = pm
- if format == "hand" then
- w.Part1 = Player.Character:FindFirstChild("Right Arm")
- w.C0 = CFrame.new(0, 0, 1.2) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
- w.C1 = CFrame.new()
- d.Face = "Front"
- elseif format == "holster" then
- w.Part1 = Player.Character:FindFirstChild("Left Leg")
- w.C0 = CFrame.new(0, -0.4, -0.5)
- w.C1 = CFrame.new()
- d.Face = "Back"
- bottle.Name = Name.. " (Holstered)"
- end
- w.Parent = pm
- local s = Instance.new("Sound")
- s.Name = "Drink"
- s.SoundId = "http://www.roblox.com/Asset/?id=10722059"
- s.Volume = 1
- s.Pitch = 1
- s.Looped = false
- s.Parent = pm
- local s = Instance.new("Sound")
- s.Name = "Open"
- s.SoundId = "http://www.roblox.com/Asset/?id=10721950"
- s.Volume = 1
- s.Pitch = 1.5
- s.Looped = false
- s.Parent = pm
- local s = Instance.new("Sound")
- s.Name = "Throw"
- s.SoundId = "http://www.roblox.com/Asset/?id=18426149"
- s.Volume = 1
- s.Pitch = 1
- s.Looped = false
- s.Parent = pm
- end
- function removeParts(format)
- if format == "hand" then
- if Player.Character:FindFirstChild(Name) ~= nil then
- Player.Character[Name]:Remove()
- end
- elseif format == "holster" then
- if Player.Character:FindFirstChild(Name.. " (Holstered)") ~= nil then
- Player.Character[Name.. " (Holstered)"]:Remove()
- end
- end
- end
- function SetAngle(Joint, Angle, Character)
- if Character == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder 2"),
- Character.Torso:FindFirstChild("Left Shoulder 2"),
- Character.Torso:FindFirstChild("Right Hip 2"),
- Character.Torso:FindFirstChild("Left Hip 2")
- }
- if Joints[Joint] == nil then return false end
- if Joint == 1 or Joint == 3 then
- Joints[Joint].DesiredAngle = Angle
- end
- if Joint == 2 or Joint == 4 then
- Joints[Joint].DesiredAngle = -Angle
- end
- end
- function ForceAngle(Joint, Angle, Character)
- if Character == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder 2"),
- Character.Torso:FindFirstChild("Left Shoulder 2"),
- Character.Torso:FindFirstChild("Right Hip 2"),
- Character.Torso:FindFirstChild("Left Hip 2")
- }
- if Joints[Joint] == nil then return false end
- if Joint == 1 or Joint == 3 then
- Joints[Joint].DesiredAngle = Angle
- Joints[Joint].CurrentAngle = Angle
- end
- if Joint == 2 or Joint == 4 then
- Joints[Joint].DesiredAngle = -Angle
- Joints[Joint].CurrentAngle = -Angle
- end
- end
- function SetSpeed(Joint, Speed, Character)
- if Character == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder 2"),
- Character.Torso:FindFirstChild("Left Shoulder 2"),
- Character.Torso:FindFirstChild("Right Hip 2"),
- Character.Torso:FindFirstChild("Left Hip 2")
- }
- if Joints[Joint] == nil then return false end
- Joints[Joint].MaxVelocity = Speed
- end
- function DisableLimb(Limb, Character)
- if Character == nil then return false end
- if Character:FindFirstChild("Torso") == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder"),
- Character.Torso:FindFirstChild("Left Shoulder"),
- Character.Torso:FindFirstChild("Right Hip"),
- Character.Torso:FindFirstChild("Left Hip")
- }
- local Limbs = {
- Character:FindFirstChild("Right Arm"),
- Character:FindFirstChild("Left Arm"),
- Character:FindFirstChild("Right Leg"),
- Character:FindFirstChild("Left Leg")
- }
- if Joints[Limb] == nil then return false end
- if Limbs[Limb] == nil then return false end
- local Joint = Instance.new("Motor")
- Joint.Parent = Character.Torso
- Joint.Part0 = Character.Torso
- Joint.Part1 = Limbs[Limb]
- if Limb == 1 then
- Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joint.Name = "Right Shoulder 2"
- elseif Limb == 2 then
- Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joint.Name = "Left Shoulder 2"
- elseif Limb == 3 then
- Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joint.Name = "Right Hip 2"
- elseif Limb == 4 then
- Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joint.Name = "Left Hip 2"
- end
- Joint.MaxVelocity = Joints[Limb].MaxVelocity
- Joint.CurrentAngle = Joints[Limb].CurrentAngle
- Joint.DesiredAngle = Joints[Limb].DesiredAngle
- Joints[Limb]:Remove()
- end
- function ResetLimbCFrame(Limb, Character)
- if Character == nil then return false end
- if Character.Parent == nil then return false end
- if Character:FindFirstChild("Torso") == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder 2"),
- Character.Torso:FindFirstChild("Left Shoulder 2"),
- Character.Torso:FindFirstChild("Right Hip 2"),
- Character.Torso:FindFirstChild("Left Hip 2")
- }
- local Limbs = {
- Character:FindFirstChild("Right Arm"),
- Character:FindFirstChild("Left Arm"),
- Character:FindFirstChild("Right Leg"),
- Character:FindFirstChild("Left Leg")
- }
- if Joints[Limb] == nil then return false end
- if Limbs[Limb] == nil then return false end
- if Limb == 1 then
- Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- elseif Limb == 2 then
- Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- elseif Limb == 3 then
- Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
- elseif Limb == 4 then
- Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
- end
- end
- function EnableLimb(Limb, Character)
- if Character == nil then return false end
- if Character:FindFirstChild("Torso") == nil then return false end
- local Joints = {
- Character.Torso:FindFirstChild("Right Shoulder 2"),
- Character.Torso:FindFirstChild("Left Shoulder 2"),
- Character.Torso:FindFirstChild("Right Hip 2"),
- Character.Torso:FindFirstChild("Left Hip 2")
- }
- local Limbs = {
- Character:FindFirstChild("Right Arm"),
- Character:FindFirstChild("Left Arm"),
- Character:FindFirstChild("Right Leg"),
- Character:FindFirstChild("Left Leg")
- }
- if Joints[Limb] == nil then return false end
- if Limbs[Limb] == nil then return false end
- if Limb == 1 then
- Joints[Limb].Name = "Right Shoulder"
- elseif Limb == 2 then
- Joints[Limb].Name = "Left Shoulder"
- elseif Limb == 3 then
- Joints[Limb].Name = "Right Hip"
- elseif Limb == 4 then
- Joints[Limb].Name = "Left Hip"
- end
- for i = 1, #Joints do
- if Joints[i] == nil then
- local Joint = Instance.new("Motor")
- if i == 1 then
- Joint.Name = "Right Shoulder"
- elseif i == 2 then
- Joint.Name = "Left Shoulder"
- elseif i == 3 then
- Joint.Name = "Right Hip"
- elseif i == 4 then
- Joint.Name = "Left Hip"
- end
- Joint.Parent = Character.Torso
- end
- end
- Animate = Character:FindFirstChild("Animate")
- if Animate == nil then return false end
- Animate = Animate:Clone()
- Character.Animate:Remove()
- Animate.Parent = Character
- end
- function playAnimation(format, mouse)
- if format == "normal" then
- if Player.Character:FindFirstChild("Torso") ~= nil then
- for i = 10, 0, -1 do
- if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
- Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 - i), 0)
- Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
- else return false end
- wait()
- end
- else return false end
- end
- if format == "drinkStart" then
- if Player.Character:FindFirstChild("Torso") ~= nil then
- for i = 0, 10, 1 do
- if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
- Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - i / 50, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 + i * 3.5), 0)
- Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
- end
- wait()
- end
- end
- end
- if format == "drinkLoopStart" then
- if Player.Character:FindFirstChild("Torso") ~= nil then
- for i = 0, 10, 1 do
- if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
- Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i * 2), math.rad(135), 0)
- Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
- end
- wait()
- end
- end
- end
- if format == "drinkLoopStop" then
- if Player.Character:FindFirstChild("Torso") ~= nil then
- for i = 10, 0, -1 do
- if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
- Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.25, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(i * 2), math.rad(135), 0)
- Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
- end
- wait()
- end
- end
- end
- if format == "drinkStop" then
- if Player.Character:FindFirstChild("Torso") ~= nil then
- for i = 10, 0, -1 do
- if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
- Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 - i / 50, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(100 + i * 3.5), 0)
- Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-3), math.rad(90), 0)
- end
- wait()
- end
- end
- end
- end
- function Weld(x, y)
- weld = Instance.new("Weld")
- weld.Part0 = x
- weld.Part1 = y
- CJ = CFrame.new(x.Position)
- C0 = x.CFrame:inverse() * CJ
- C1 = y.CFrame:inverse() * CJ
- weld.C0 = C0
- weld.C1 = C1
- weld.Parent = x
- end
- loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
- function onButton1Down(mouse)
- if selected == false then return end
- if Player.Character:FindFirstChild(Name) ~= nil and Button1Down ~= true and canUse == true then
- if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
- Button1Down = true
- canUse = false
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- if open.Value == false then
- Player.Character[Name].Handle.Open:Play()
- wait(0.5)
- open.Value = true
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- canUse = true
- elseif contents.Value > 0 then
- playAnimation("drinkStart", mouse)
- while contents.Value > 0 and Button1Down == true do
- local delta = math.random(3, 10)
- contents.Value = contents.Value - delta
- if contents.Value < 0 then contents.Value = 0 end
- script.Parent.Name = tostring(contents.Value).. "%"
- if Player.Character == nil then break end
- if Player.Character:FindFirstChild(Name) == nil then break end
- if Player.Character[Name]:FindFirstChild("Handle") == nil then break end
- if Player.Character:FindFirstChild("Humanoid") == nil then break end
- Player.Character.Humanoid.Health = Player.Character.Humanoid.Health + (delta / 2)
- Player.Character[Name].Handle.Drink.Volume = math.random(50, 80) / 100
- Player.Character[Name].Handle.Drink.Pitch = math.random(90, 110) / 100
- Player.Character[Name].Handle.Drink:Play()
- coroutine.resume(coroutine.create(function() playAnimation("drinkLoopStart", mouse) end))
- wait(math.random(9, 11) / 10)
- coroutine.resume(coroutine.create(function() playAnimation("drinkLoopStop", mouse) end))
- Player.Character[Name].Handle.Drink:Stop()
- wait(0.3)
- end
- playAnimation("drinkStop", mouse)
- script.Parent.Name = Name
- canUse = true
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- else
- canUse = true
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- end
- end
- end
- function onButton1Up(mouse)
- if selected == false then return end
- Button1Down = false
- end
- function onKeyDown(key, mouse)
- if selected == false then return end
- key = key:lower()
- if key == "q" and Button1Down == false and canUse == true then
- if mouse.Target == nil then return end
- if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
- onDeselected(mouse)
- removeParts("holster")
- script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
- end
- end
- if key == "z" and Button1Down == false and canUse == true then
- if Player.Character:FindFirstChild(Name) == nil then makeParts("hand") end
- if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
- canUse = false
- SetAngle(1, math.rad(200), Player.Character)
- SetSpeed(1, 0.5, Player.Character)
- wait(0.3)
- SetAngle(1, math.rad(0), Player.Character)
- SetSpeed(1, 0.75, Player.Character)
- wait(0.05)
- if Player.Character[Name].Handle:FindFirstChild("Weld") ~= nil then Player.Character[Name].Handle.Weld:Remove() end
- bodyVelocity = Instance.new("BodyVelocity")
- bodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- bodyVelocity.velocity = (mouse.Hit.p - Player.Character[Name].Handle.Position).unit * 100
- bodyVelocity.Parent = Player.Character[Name].Handle
- Player.Character[Name].Handle.Open:Stop()
- Player.Character[Name].Handle.Drink:Stop()
- Player.Character[Name].Handle.Throw.PlayOnRemove = true
- Player.Character[Name].Handle.Throw:Remove()
- wait(0.25)
- bodyVelocity:Remove()
- local model = Player.Character[Name]
- model.Parent = Workspace
- model:MakeJoints()
- onDeselected(mouse)
- removeParts("holster")
- script.Parent:Remove()
- end
- end
- function onSelected(mouse)
- if selected == true then return end
- selected = true
- mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
- while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
- if Player.Character.WeaponActivated.Value == nil then break end
- if Player.Character.WeaponActivated.Value.Parent == nil then break end
- wait()
- end
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- removeParts("holster")
- makeParts("hand")
- weapon = Instance.new("ObjectValue")
- weapon.Name = "WeaponActivated"
- weapon.Value = script.Parent
- weapon.Parent = Player.Character
- DisableLimb(1, Player.Character)
- SetAngle(1, math.rad(90), Player.Character)
- if playAnimation("normal") == false then onDeselected(mouse) end
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- mouse.Button1Up:connect(function() onButton1Up(mouse) end)
- mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
- end
- function onDeselected(mouse)
- if selected == false then return end
- selected = false
- while Button1Down == true do
- wait()
- end
- if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
- if Player.Character.WeaponActivated.Value == script.Parent then
- Player.Character.WeaponActivated:Remove()
- end
- end
- while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
- if Player.Character.WeaponActivated.Value == nil then break end
- if pcall(function() if Player.Character.WeaponActivated.Value.Parent == nil then return true end end) then break end
- wait()
- end
- removeParts("hand")
- makeParts("holster")
- SetAngle(1, 0, Player.Character)
- ResetLimbCFrame(1, Player.Character)
- EnableLimb(1, Player.Character)
- end
- if script.Parent.ClassName ~= "HopperBin" then
- if Player == nil then print("Error: Player not found!") return end
- Tool = Instance.new("HopperBin")
- Tool.Name = Name
- Tool.Parent = Player.Backpack
- script.Name = "Main"
- script.Parent = Tool
- elseif script.Parent.ClassName == "HopperBin" then
- while script.Parent.Parent.ClassName ~= "Backpack" do
- wait()
- end
- if script.Parent:FindFirstChild("Contents") == nil then
- contents = Instance.new("NumberValue")
- contents.Name = "Contents"
- contents.Value = 100
- contents.Parent = script.Parent
- else
- contents = script.Parent.Contents
- end
- if script.Parent:FindFirstChild("Opened") == nil then
- open = Instance.new("BoolValue")
- open.Name = "Opened"
- open.Value = false
- open.Parent = script.Parent
- else
- open = script.Parent.Opened
- end
- Player = script.Parent.Parent.Parent
- makeParts("holster")
- script.Parent.Selected:connect(onSelected)
- script.Parent.Deselected:connect(onDeselected)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement