Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SERVICES
- local ServerStorage = game:GetService("ServerStorage")
- local PhysicsService= game:GetService("PhysicsService")
- local CollectionService = game:GetService("CollectionService")
- -- MODULES
- local Modules = ServerStorage.Modules
- -- ASSETS
- local Assets = ServerStorage.Assets
- local Props = Assets.Props
- -- VARIABLES
- local Hitboxes = workspace.Hitboxes
- -- FUNCTIONS
- function GenerateHitbox(Player, Prop)
- local PrevHitbox = Hitboxes:FindFirstChild(Player.Name)
- if PrevHitbox then
- PrevHitbox:Destroy()
- end
- local Root = Player.Character.HumanoidRootPart
- local Hitbox = Instance.new("Part")
- Hitbox.Name = Player.Name
- Hitbox.Transparency = 1
- Hitbox.CanCollide = false
- Hitbox.Size = Prop.Size + Vector3.new(2, 2, 2)
- local Weld = Instance.new("Motor6D")
- Weld.Part0 = Prop
- Weld.Part1 = Hitbox
- Weld.Parent = Hitbox
- local RootPos = Root.CFrame
- Hitbox.Parent = workspace.Hitboxes
- Root.CFrame = RootPos
- Hitbox:SetNetworkOwner(Player)
- end
- function ChangeLegCollision(Character, Leg)
- PhysicsService:SetPartCollisionGroup(Character[Leg.."Foot"], "Legs")
- PhysicsService:SetPartCollisionGroup(Character[Leg.."LowerLeg"], "Legs")
- PhysicsService:SetPartCollisionGroup(Character[Leg.."UpperLeg"], "Legs")
- end
- return function(Player, Prop)
- local Session = _G.GetSessionData(Player)
- local Character = Player.Character
- local Root = Character.HumanoidRootPart
- Session.Props = Session.Props + 1
- Session["Unique Props"][Prop] = true
- local PreviousProp = workspace.Props:FindFirstChild(Player.Name)
- if PreviousProp then
- PreviousProp:Destroy()
- else
- CollectionService:AddTag(Character, "Prop")
- ChangeLegCollision(Character, "Left")
- ChangeLegCollision(Character, "Right")
- for _, Object in pairs(Character:GetDescendants()) do
- if Object:IsA("BasePart") then
- Object.Transparency = 1
- end
- end
- Character.HumanoidRootPart.Transparency = 1
- Character.Head.face.Parent = Character
- Character.Humanoid.HipHeight = .3
- end
- local String = Instance.new("StringValue")
- String.Name = "PropName"
- String.Value = Prop
- local Prop = Props[Prop]:Clone()
- local Weld = Instance.new("Motor6D")
- Prop.Name = Player.Name
- Weld.Part0 = Character.HumanoidRootPart
- Weld.Part1 = Prop
- Weld.C0 = CFrame.new(0, (-1.3 + Prop.Size.Y/2), 0)
- Weld.Parent = Prop
- String.Parent = Prop
- Prop.Parent = workspace.Props
- Prop:SetNetworkOwner(Player)
- GenerateHitbox(Player, Prop)
- CollectionService:AddTag(Prop, "Prop")
- PhysicsService:SetPartCollisionGroup(Prop, "Props")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement