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

Union Part's Size Not Changing. Can Someone Help Me Fix This?

Asked by
epoke466 100
3 years ago

I am making a zone that kills players for my battle royal game. The zone shrinks overtime and eventually resets. There's a lot of other stuff in the scripts that makes this happen so you can just ignore that. Here is the main script:

function movezone ()
    script.MoveZone.Disabled = false  --MoveZone is the script that makes the zone shrink.
--The script is located inside the main script and it does make the zone shrink and stops moving the zone when the resetzone function occurs. I put the script at the very end.
end

function resetzone () --This function is where I believe the error is. 
--Everything but the zone resetting appears to be working.

    script.MoveZone.Disabled = true
    game.Workspace.Zone.Size = Vector3.new(2048, 1055.914, 2048)
end




function spawnplayers ()
    game.Workspace.Spawns.JoinGame.Parent = game.ServerStorage
    game.ServerStorage.GameSpawn.Parent = game.Workspace.Spawns
    wait(1)

    for i, player in ipairs(game.Players:GetPlayers()) do
        player.RespawnLocation = game.Workspace.Spawns.GameSpawn
        if player.Character then
            local hum = player.Character:FindFirstChild('Humanoid')
            if hum then
                hum.Health = 0
            end 
        end
    end

    local information = Instance.new("Message")
    information.Text = "Run For Your Life, The Hounds Have Benn RELEASED!!!"
    information.Parent = game.Workspace
    wait(5)
    information:Destroy()

    movezone()

    wait(5)

    game.Workspace.Spawns.GameSpawn.Parent = game.ServerStorage
    game.ServerStorage.JoinGame.Parent = game.Workspace.Spawns

end


function resetplayers ()
    for i, player in ipairs(game.Players:GetPlayers()) do
        if player.Character then
            local hum = player.Character:FindFirstChild('Humanoid')
            if hum then
                hum.Health = 0
            end 
        end
    end

    resetzone()

end

--eventually the below functions will become automated inside the game but I need a way to test them before I add a ton of fancy stuff. The functions do happen when the player touches the part so this is not the problem.

game.Workspace.Test.Touched:Connect(spawnplayers)
game.Workspace.TestUnspawn.Touched:Connect(resetplayers)

Here is the script that makes the zone shrink. It is called MoveZone and starts out disabled. It is located inside the main script:

while wait() do
    wait(0.001)
    game.Workspace.Zone.Size = game.Workspace.Zone.Size - Vector3.new(1,0,1) 
    end

Again, the problem is that the zone does not reset. If this matters at all the zone is a union part that is located in workspace. Can someone please help me fix this?

0
do you get any errors? you can check when play testing (press F9) NGC4637 602 — 3y

1 answer

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

Unions are unable to stretch, but MeshParts can. You should import your union to a MeshPart, and you can stretch it.

Heres a tutorial that might help, it's very simple: How to convert Union to a MeshPart?

0
Thankyou so much! epoke466 100 — 3y
Ad

Answer this question