Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local grenade = script.Parent
- local re = grenade:WaitForChild("ThrowRE")
- local cooldown = false
- local ps = game:GetService("PhysicsService")
- ps:CreateCollisionGroup("Grenade")
- ps:CreateCollisionGroup("Character")
- ps:CollisionGroupSetCollidable("Character", "Grenade", false)
- re.OnServerEvent:Connect(function(plr, mouseHit)
- if cooldown then return end
- cooldown = true
- local grenadeCopy = grenade.Handle:Clone()
- for i, descendant in pairs(plr.Character:GetDescendants()) do
- if descendant:IsA("BasePart") then ps:SetPartCollisionGroup(descendant, "Character") end
- end
- ps:SetPartCollisionGroup(grenadeCopy, "Grenade")
- local velocity = (mouseHit.Position - Vector3.new(0, -game.Workspace.Gravity * 0.3, 0))
- grenadeCopy.Velocity = velocity
- grenadeCopy.CanCollide = true
- grenadeCopy.Parent = workspace
- grenade.Handle.Transparency = 1
- wait(3)
- grenadeCopy.Smoke.Enabled = true
- grenadeCopy.Explode:Play()
- wait(grenadeCopy.Explode.TimeLength)
- grenadeCopy:Destroy()
- grenade.Handle.Transparency = 0
- cooldown = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement