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

How do I make this part get destroyed on my death, or come back to me when i respawn?

So, I made this cloud that basically levitates and follows me but when I reset, it just stays there and does nothing, like it broke. So, when I die, I want it to come back to me, or get destroyed, thanks!


b = Vector3.new(0,19,0)
a = Vector3.new(0,20,0)
c = Vector3.new(0,10,0)
puff= game.Workspace.puffscocofeafea.Torso
humanoid = game.Workspace.puffscocofeafea.Humanoid
brick = Instance.new("Part", game.Workspace)
brick.Name = "Float"
brick.Size = Vector3.new(6, 4.58, 1.57)
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
puffposition=puff.Position

mesh = Instance.new("SpecialMesh",brick)
mesh.Scale = Vector3.new(10,10,10)
mesh.TextureId = "http://www.roblox.com/asset/?id=1095709"
mesh.MeshType = "FileMesh"
mesh.MeshId = "http://www.roblox.com/asset/?id=1095708"
mesh.VertexColor = Vector3.new(1,1,1)

lasso = Instance.new("SelectionPartLasso", brick)
lasso.Humanoid = humanoid
lasso.Part = brick

force = Instance.new("BodyPosition",brick)
force.maxForce = Vector3.new(50000, 50000, 50000)

while true do
wait(.001)
force.position = puff.Position + c
wait(.2)
end




1 answer

✓ Accepted answer

Try using this its better to use while wait() do than while true do

b = Vector3.new(0,19,0)
a = Vector3.new(0,20,0)
c = Vector3.new(0,10,0)
puff= game.Workspace.puffscocofeafea.Torso
humanoid = game.Workspace.puffscocofeafea.Humanoid
brick = Instance.new("Part", game.Workspace)
brick.Name = "Float"
brick.Size = Vector3.new(6, 4.58, 1.57)
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
puffposition=puff.Position

mesh = Instance.new("SpecialMesh",brick)
mesh.Scale = Vector3.new(10,10,10)
mesh.TextureId = "http://www.roblox.com/asset/?id=1095709"
mesh.MeshType = "FileMesh"
mesh.MeshId = "http://www.roblox.com/asset/?id=1095708"
mesh.VertexColor = Vector3.new(1,1,1)

lasso = Instance.new("SelectionPartLasso", brick)
lasso.Humanoid = humanoid
lasso.Part = brick

force = Instance.new("BodyPosition",brick)
force.maxForce = Vector3.new(50000, 50000, 50000)

while wait() do
wait(.001)
force.Position = puff.Position + c
wait(.2)
if humanoid.Health == 0 then
	brick:Destroy()
end
end

It should remove it when the player dies.

7 comments

0

Your change in the script canceled out the movement which is "force.position = puff.Position + c"

0

Oh I see

0

Try that, I should work under one function and it uses the humanoid located up there.

0

Thanks, there was an error but I got it and it works, but of the function its only when i lose my health, if I get respawned, it will still be there because I never lost any health.

0

what's that way to check if my humanoid or torso is in my body? is it like "if Torso == nil then brick:destroy()" i know that was wrong but isnt there something like that lol

0

I believe so. I tried your script, but the beginning of the script causes an error for me.

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