Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is the a way to prevent a grenade from bouncing too much?

When I make a grenade the projectile bounces too much when it hits the ground. If I decrease the velocity of it, it still bounces and can't go as far. Is there a way to stop it from bouncing too much?

script.Parent.Parent:WaitForChild("Events").ThrowEvent.OnServerEvent:Connect(function(player, weapon, target)
	local grenade = script.Parent.Parent.Handle:Clone()
	grenade.CFrame = CFrame.new(grenade.CFrame.p, target)
	grenade.Velocity = grenade.CFrame.LookVector * 200
	grenade.Parent = workspace
	grenade.Anchored = false
	grenade.CanCollide = true
	game:GetService("Debris"):AddItem(grenade, 60)
	script.Parent.Parent.Handle.Transparency = 1
	wait(3)
	
	script.Parent.Parent.Handle.Transparency = 0
	grenade:Destroy()	
	local explosion = Instance.new("Explosion", workspace.Baseplate)
	explosion.BlastPressure = 0
	explosion.BlastRadius = 8
	explosion.ExplosionType = Enum.ExplosionType.NoCraters
	explosion.Position = grenade.Position
	explosion.Hit:Connect(function(part, distance)
		local humanoid = part.Parent:FindFirstChild("Humanoid")
		if humanoid and not debounce then
			debounce = true
			humanoid:TakeDamage(115 - (distance * 5))
			if humanoid.Health <= 0 and game:GetService("ReplicatedStorage").Gamemode.Value == "Team Deathmatch" then
				player.leaderstats.Kills.Value = player.leaderstats.Kills.Value + 1
				player.leaderstats.Streak.Value = player.leaderstats.Streak.Value + 1	
				game:GetService("ReplicatedStorage").ScoreValues[player.Team.Name.."ScoreValue"].Value = game:GetService("ReplicatedStorage").ScoreValues[player.Team.Name.."ScoreValue"].Value + 1				
			end
			wait(math.huge)
			debounce = false
		end	
	end)
end)

2 comments

0

why do you wait math.huge seconds to set debounce to false. But you can use a BodyForce with negative force on the Y axis so it's forced downwards

1

YOOOOOOOOOOOOO ROBOT KILLER IS BACK LETS GOOOOO WELCOME BACK :D

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.