Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
1
Answered by
yoshi8080 445 Moderation Voter
8 years ago

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.

0
Your change in the script canceled out the movement which is "force.position = puff.Position + c" puffscocofeafea 10 — 8y
0
Oh I see yoshi8080 445 — 8y
0
Try that, I should work under one function and it uses the humanoid located up there. yoshi8080 445 — 8y
View all comments (3 more)
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. puffscocofeafea 10 — 8y
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 puffscocofeafea 10 — 8y
0
I believe so. I tried your script, but the beginning of the script causes an error for me. yoshi8080 445 — 8y
Ad

Answer this question