Basically I have a problem where when my character touches a block it gets anchored then unanchored but it doesn’t seem to work
local IceBlock = Instance.new("Part")
IceBlock.Name = "Ice"
IceBlock.Anchored = true
IceBlock.BrickColor = BrickColor.new("ToothPaste")
IceBlock.Transparency = 0.5
IceBlock.Size = Vector3.new(5,7,5)
local function Freeze(character,Bool)
for _,CharacterPart in pairs(character:GetChildren()) do
if CharacterPart:IsA("BasePart") then
CharacterPart.Anchored = Bool
end
end
end
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Dealer") == nil and hit.Parent:FindFirstChild("Hurt") == nil then
local char = hit.Parent
local hurtbool = Instance.new("BoolValue",char)
hurtbool.Name = "Hurt"
game.Debris:AddItem(hurtbool,4)
char:FindFirstChild("Humanoid"):TakeDamage(40)
char.Archivable = true
local IceBlockClone = IceBlock:Clone()
IceBlockClone.Parent = game.Workspace
IceBlockClone.CFrame = char.HumanoidRootPart.CFrame
Freeze(char,true)
wait(4)
Freeze(char,false)
end
end)