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?
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?