How do I make player only take damage once?

idk how to do this but this is the script

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:FindFirstChild("Humanoid")

local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()

local rs = game:GetService("ReplicatedStorage")
local effectthings = rs:FindFirstChild("fx")

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(.5)

tool.Activated:Connect(function()
	local newball = effectthings.Ball:Clone()
	local startPos = mouse.Hit.Position
	local tween = ts:Create(newball,ti,{Size = Vector3.new(20,20,20)})
	newball.Parent = workspace
	newball.Position = startPos
	wait(.7)
	tween:Play()
	newball.Touched:Connect(function()
		hum.Health = hum.Health - 50
	end)
end)

vid: https://youtu.be/5eEjwAPBv7I

Just put the RBXCONNECTION to a variable and disconnect it once taken damage. It will continue to connect once cloned

Instead of using Connect, you can use Once. This does the same thing as Connect, but automatically disconnects (or stops) the connection after it is triggered once.

2 Likes

Wow that was easy! Thank you!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.