Hey! I’m trying to make a zone that tweens automatically, after you use a command (say !startzone in the chat, if you are on the whitelist). It basically works like Fortnite. It tweens only a part, then stops. After some time, it tweens again. It repeats this process 20 times, until its finished fully.
Obviously, as there is a Roblox scale limit, I’m making it via multiple parts, that are being cloned.
However, there the issue comes. I need to position the newly cloned parts, so that they are in front of the already tweened zone parts, basically. I am able to do this for the first time, as I will just change the position based off of the part behind it. The problem though is that I’d need to do this every time, position the new cloned parts individually, with the new positions (the more it scales, the more the position will change). But I’m not sure how to do that.
ServerScript:
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local AnnouncementEvent = RS:WaitForChild("ZoneAnnouncement")
local SoundService = game:GetService("SoundService")
local AnnouncementSound = SoundService:WaitForChild("ZoneAnnouncement")
local SS = game:GetService("ServerStorage")
local ModelFolder = workspace:WaitForChild("Zone")
local ZoneFolder = SS:WaitForChild("ZoneParts")
local zoneCount = 0
local zone1 = ModelFolder:WaitForChild("Zone1")
local zone2 = ModelFolder:WaitForChild("Zone2")
local zone3 = ModelFolder:WaitForChild("Zone3")
local zone4 = ModelFolder:WaitForChild("Zone4")
local part1 = ZoneFolder:WaitForChild("1")
local part2 = ZoneFolder:WaitForChild("2")
local part3 = ZoneFolder:WaitForChild("3")
local part4 = ZoneFolder:WaitForChild("4")
local whitelist = {"y_acines";"SwornStallions";"witchdefence123";"atxmiczz";"Necrosial";"syncouI";"Emirati_an";"austri_an";"Afgh_an";"Nyxifier"}
local Tween_Info = TweenInfo.new(5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local tweenInfo1 = {
Size = zone1.Size + Vector3.new(0,0,399.80675);
Position = zone1.Position - Vector3.new(199.903375,0,0)
}
local tween1 = TweenService:Create(zone1,Tween_Info,tweenInfo1)
local tweenInfo2 = {
Size = zone2.Size + Vector3.new(0,0,399.80675);
Position = zone2.Position - Vector3.new(199.903375,0,0)
}
local tween2 = TweenService:Create(zone2,Tween_Info,tweenInfo2)
local tweenInfo3 = {
Size = zone3.Size + Vector3.new(0,0,399.80675);
Position = zone3.Position - Vector3.new(199.903375,0,0)
}
local tween3 = TweenService:Create(zone3,Tween_Info,tweenInfo3)
local tweenInfo4 = {
Size = zone4.Size + Vector3.new(0,0,399.80675);
Position = zone4.Position - Vector3.new(199.903375,0,0)
}
local tween4 = TweenService:Create(zone4,Tween_Info,tweenInfo4)
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
local Words = string.split(Message, " ")
if Words[1] == "!startzone" then
if table.find(whitelist, Player.Name) then
print("Started the zone!")
AnnouncementEvent:FireAllClients()
AnnouncementSound:Play()
zone1.Transparency = 0.2
zone2.Transparency = 0.2
zone3.Transparency = 0.2
zone4.Transparency = 0.2
tween1:Play()
tween2:Play()
tween3:Play()
tween4:Play()
zoneCount += 1
while wait(10) do
if zoneCount > 0 and zoneCount < 20 then
local clone1 = part1:Clone()
local clone2 = part2:Clone()
local clone3 = part3:Clone()
local clone4 = part4:Clone()
clone1.Parent = ModelFolder
clone2.Parent = ModelFolder
clone3.Parent = ModelFolder
clone4.Parent = ModelFolder
clone1.Position = clone1.Position - Vector3.new(399.80675,0,0)
clone2.Position = clone2.Position - Vector3.new(399.80675,0,0)
clone3.Position = clone3.Position - Vector3.new(399.80675,0,0)
clone4.Position = clone4.Position - Vector3.new(399.80675,0,0)
local newTweenInfo1 = {
Size = clone1.Size + Vector3.new(0,0,399.80675);
Position = clone1.Position - Vector3.new(199.903375,0,0)
}
local newTween1 = TweenService:Create(clone1,Tween_Info,newTweenInfo1)
local newTweenInfo2 = {
Size = clone2.Size + Vector3.new(0,0,399.80675);
Position = clone2.Position - Vector3.new(199.903375,0,0)
}
local newTween2 = TweenService:Create(clone2,Tween_Info,newTweenInfo2)
local newTweenInfo3 = {
Size = clone3.Size + Vector3.new(0,0,399.80675);
Position = clone3.Position - Vector3.new(199.903375,0,0)
}
local newTween3 = TweenService:Create(clone3,Tween_Info,newTweenInfo3)
local newTweenInfo4 = {
Size = clone4.Size + Vector3.new(0,0,399.80675);
Position = clone4.Position - Vector3.new(199.903375,0,0)
}
local newTween4 = TweenService:Create(clone4,Tween_Info,newTweenInfo4)
newTween1:Play()
newTween2:Play()
newTween3:Play()
newTween4:Play()
zoneCount += 1
elseif zoneCount == 20 then
print("Zone shrining ended!")
break
end
end
else
print("You're not allowed to use this command!")
end
end
end)
end)
LocalScript:
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGUI = LocalPlayer.PlayerGui
local RS = game:GetService("ReplicatedStorage")
local Event = RS:WaitForChild("ZoneAnnouncement")
Event.OnClientEvent:Connect(function()
local GUI = PlayerGUI:WaitForChild("ZoneAnnouncement")
local HolderFrame = GUI:WaitForChild("Holder")
local Text = HolderFrame:WaitForChild("Announcement")
HolderFrame.Visible = true
HolderFrame:TweenPosition(UDim2.new(0.463,0,0.44,0),"Out","Quad",0.7,true)
wait(3)
HolderFrame:TweenPosition(UDim2.new(0.463,0,0.3,0),"Out","Quad",0.7,true)
wait(0.7)
HolderFrame.Visible = false
end)