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

how do I make a water balloon? I think I almost got it but I don't know

I have made the tool and everything this is the local script:

local player =game.Players.LocalPlayer
local mouse = player:GetMouse()

script.Parent.Activated:Connect(function()
	script.Parent.PickenTarget:FireServer(mouse.Hit.p)
end)

I think I have got that down and it is good

here is the script

local db = false

local directon

local debris = game:GetService("Debris")

script.Parent.PickenTarget.OnServerEvent:Connect(function(player,mouse)
	directon = mouse
end)

script.Parent.Equipped:Connect(function()
	for i = 0,-4,-.5 do
		script.Parent.GripPos = Vector3.new(0,i,0)
		wait()
	end
	for i = -4,0,.5 do
		script.Parent.GripPos = Vector3.new(0,i,0)
		wait()
	end
end)

script.Parent.Activated:Connect(function()
	if not db then
		db = true
		
		-- Play the animation
		
		local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
		local throwAnim = humanoid:LoadAnimation(script.Throw)
		throwAnim:Play()
		
		wait(.5)
		
		-- Throws the ball
		script.Parent.Handle.Throw:Play()
		script.Parent.Handle.Transparency = 1
		local ball = Instance.new("Part",workspace)
		ball.Shape = "Ball"
		ball.Material = Enum.Material.Slate
		ball.Color = Color3.fromRGB(255,255,255)
		ball.Size = Vector3.new(1,1,1)
		ball.CFrame = CFrame.new(script.Parent.Handle.Position + script.Parent.Handle.CFrame.LookVector * 3,directon)
		
		local attachment0 = Instance.new("Attachment",ball); attachment0.Position = Vector3.new(-.5,0,0); attachment0.Orientation = Vector3.new(0,180,0)
		local attachment1 = Instance.new("Attachment",ball); attachment1.Position = Vector3.new(.5,0,0)
		local trail = Instance.new("Trail",ball); trail.Attachment0 = attachment0; trail.Attachment1 = attachment1
		
		local bv = Instance.new("BodyVelocity",ball)
		bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
		bv.P = 3000
		
		local ori = 0
		
		spawn(function()
			while wait() do
				ori = ori - .1
				ball.CFrame = ball.CFrame + ball.CFrame.lookVector * 4
				ball.Orientation = Vector3.new(ball.Orientation.X + ori,ball.Orientation.Y, ball.Orientation.Z)
			end
		end)
		
		-- When a ball touch something
		
		ball.Touched:Connect(function(hit)
			ball:Destroy()
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if player then
				local char = player.Character
				local humanoid = char:FindFirstChild("Humanoid")
				humanoid.Health = 0
				humanoid.PlatformStand = true
			end
			local effect = Instance.new("Part",workspace)
			effect.Size = Vector3.new(1,1,1)
			effect.CanCollide = false
			effect.Color = Color3.fromRGB(255,255,255)
			effect.BottomSurface = Enum.SurfaceType.Smooth
			effect.TopSurface = Enum.SurfaceType.Smooth
			effect.CFrame = ball.CFrame + Vector3.new(0,1,0)
			local hitSFX = Instance.new("Sound",effect); hitSFX.SoundId = "rbxassetid://4518881974"; hitSFX:Play()
			for i = 0,10,1 do
				local clonedEffect = effect:Clone()
				clonedEffect.Parent = workspace
				clonedEffect.CFrame = ball.CFrame + Vector3.new(0,1,0)
				local bf = Instance.new("BodyForce",clonedEffect)
				bf.Force = Vector3.new(math.random(-1100,1100),math.random(0,1100),math.random(-1100,1100))
				wait()
				bf:Destroy()
				debris:AddItem(clonedEffect,5)
			end
			debris:AddItem(effect,5)
		end)
		
		-- Reloading the ball
		
		wait(.45)
		script.Parent.Handle.Scoop:Play()
		wait(.2)
		script.Parent.Handle.Scoop:Stop()
		script.Parent.Handle.Transparency = 0
		wait(.5)
		db = false
	end
end)

For some reason it won't kill my NPC I tested it with a free model and gun and the gun killed him just fine if someone could please help me.

I also don't know how to make it so it only takes a little damage out and not instant kill if someone could please help me that would be great!

Thanks!

1 answer

You can change the damage at line 70

-- This is the line that insta kills player
humanoid.Health = 0

-- If you want to make the pmayer takes 10 damage
humanoid.Health = humanoid.Health - 10

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