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

Part is deleting automatically after copying into Workspace. Can someone help me?

Asked by 4 years ago
script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.Medium.Text == "Turned on" then
        game.Lighting.Flood.BodyVelocity.Velocity = Vector3.new(0,0.95,0)
    elseif script.Parent.Parent.Fast.Text == "Turned on" then
        game.Lighting.Flood.BodyVelocity.Velocity = Vector3.new(0,2,0)
    elseif script.Parent.Parent.Slow.Text == "Turned on" then
        game.Lighting.Flood.BodyVelocity.Velocity = Vector3.new(0,0.45,0)
    end
    wait(1)
    if script.Parent.Text == "Disabled" then
        script.Parent.Text = "Enabled"
        script.Parent.Style = "RobloxRoundDefaultButton"
        game.Lighting.Flood:Clone().Parent = game.Workspace
    else
        script.Parent.Text = "Disabled"
        script.Parent.Style = "RobloxRoundButton"
        game.Workspace.Flood:Destroy()
    end
end)

I made this script, but the problem is when i click on the button in the surface gui its copying flood into workspace like for 1 second and then it somehow deletes.

Script is not a local and places inside surfacegui.

0
Is Flood.Anchored = false? If it is, it's probably falling off the map. Anchor Flood and it should not be destroyed. Twinbrotato 543 — 4y
0
It worked. But I need this part to raise, is there a way? Sasha_Syshenko 20 — 4y

1 answer

Log in to vote
0
Answered by
Xapelize 2658 Moderation Voter Community Moderator
4 years ago

There's a part to make the flood raises. Just make the Part.Size = Part.Size + Vector3.new(0,1,0) . This is simply makes the y velocity higher, so people seems it was raising, but the down part it's honestly sinking down.

If you want to make a clearer thing that if you see the ground it doesn't see the river sinking down on it, you can change the Part.Position = Part.Position + Vector3.new(0,1,0). So this means for the every flood raises up, the sinking part will goes up, but warning is you need to make the Part.Size = Part.Size + Vector3.new(0,0.5,0) instead of Part.Size = Part.Size + Vector3.new(0,1,0).

Uhh, this is a example, to make clears flood raises up (also check the underground)

while wait(1) do
    script.Parent.Size = script.Parent.Size + Vector3.new(0,0.5,0)
    script.Parent.Position = script.Parent.Position + Vector3.new(0,1,0)
end 

To be honest, I have a long time not using this, and I didn't check this out in ROBLOX studio cuz its too late to me and I have to sleep, so I will check more tmrow!

And if this worked, please mark this as the correct answer, and if this you have problems, ask below comments so I can get noficated. Thanks!

And... Bye bye c:

Ad

Answer this question