To be straightfoward, after I touch the part once the positioning of the "Crystal" in workspace gets cloned, and renamed to something else, it is then positioned to my torso. Now, the problem is after I die the "Crystal" that is renamed in the workspace DOES indeed get removed. However if I touch the part or diff part with same script again, the "Crystal" that is cloned this time is then positioned to where I last died. For example, if I died in the middle of the baseplate, I will be encased in a crystal in the middle of the baseplate until it gets removed. Now If I touch the part again, and this time walk ALLL the way to the edge of the baseplate, the crystal is now cloned again for the 2nd time BUT this time it's positioned to where I last died which was in the middle of the baseplate and not in the edge of the baseplate.
To summarize basically the crystal that is cloned and positioned to my torso per say for example in the middle of the baseplate which is then removed after I die, will still be positioned in the middle of the baseplate if I touch the part again and clone the crystal again.
local sound = game.Lighting.OOF
local particle = script.Parent.ice
local freeze = game.Workspace.Crystal
local onceonly = true
local soundeffect = workspace.Freeze
script.Parent.Touched:Connect(function(player)
if script.Parent.ice.Enabled == true then
player.BrickColor = BrickColor.new("Baby blue")
if player.Parent:FindFirstChild("Torso") then
player.Parent.Torso.BrickColor = BrickColor.new("Baby blue")
if player.Parent:FindFirstChild("Right Arm") then
player.Parent["Right Arm"].BrickColor = BrickColor.new("Baby blue")
if player.Parent:FindFirstChild("Head") then
--particle:Clone().Parent = player
sound:Clone().Parent = player
player.Parent["Head"].BrickColor = BrickColor.new("Baby blue")
if not player:FindFirstChild("ice") then
particle:Clone().Parent = player
repeat
local randomizer = math.random(1,10)
print(randomizer)
print(player.Parent.Humanoid.Health)
if randomizer == 5 and onceonly == true then
player.Parent.Humanoid.WalkSpeed = 0
soundeffect:Clone().Parent = player
player.Freeze:Play() -- too lazy to make sure that Freeze is actually inside the parameter "player"
--player.Parent.Humanoid.PlatformStand = true // looks ugly when frozen so no.
player.Parent.Torso.Anchored = true
player.Parent.Head.Anchored = true
player.Parent["Right Arm"].Anchored = true
player.Parent["Left Arm"].Anchored = true
player.Parent["Right Leg"].Anchored = true
player.Parent["Left Leg"].Anchored = true
wait(0.2)
freeze:Clone().Parent = workspace
freeze.Name = "Crystal1"
freeze.Position = player.Parent.Torso.Position -- too lazy to like.. check if humanoidrootpart exists lol
onceonly = false
end
if player.Parent.Humanoid.Health <= 1 then
wait(4)
game.Workspace:FindFirstChild("Crystal1"):Destroy() -- ugh too lazyy to confirm crystals' in workspace
onceonly = true
end
wait(1)
if player.Parent:FindFirstChild("Humanoid") then -- too lazy to confirm humanoid completely exists
player.Parent.Humanoid:TakeDamage(5)
player:FindFirstChild("OOF"):Play()
end
until not player:FindFirstChild("ice")
end
end
end
end
end
end)

1 comment
also ignore the comments like i said i've tried to change the code multiple times, until i gave up and decided to ask a question in this website.