If a player is hit by a projectile they'll become frozen, but if hit again, another block will spawn. Is there a way I can check if the player is already frozen so another block won't spawn? I've been googling for hours and I just cannot find anything. Here's the code:
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
script.Disabled = true
local torso = hit.Parent:FindFirstChild("HumanoidRootPart")
local frozen = Instance.new("Part")
frozen.Name = "IceCube"
frozen.Size = Vector3.new(6,8,6)
frozen.Material = "Ice"
frozen.BrickColor = BrickColor.new("Pastel Blue")
frozen.Transparency = "0.3"
frozen.Anchored = false
frozen.Parent = torso
local weld = Instance.new("Weld")
weld.Parent = frozen
weld.Part0 = frozen
weld.Part1 = torso
hit.Parent.HumanoidRootPart.Anchored = true
for i = 1, 10 do
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health -3
wait(0.2)
end
hit.Parent.HumanoidRootPart.Anchored = false
frozen:Remove()
script:Remove()
end
wait(0.025)
end)

2 comments
Thanks for the help!
you're welcome, and sorry for the late reply!