How do i make it doing the same process?

hello,
im doing a sort of auto match for a soccer game


basically i want that after pressed cancel match ( that will reset ) i want it to do same the process like at the start
here the main script:

local PP = game.Workspace.StadiumPlatform.GoldTrophy.Mogus
local Pad1 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad1")
local Pad2 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad2")
local Pad3 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad3")
local Pad4 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad4")
local Pad5 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad5")
local Pad6 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad6")
local Pad7 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad7")
local Pad8 = game.ServerStorage.Pitch1Pads:WaitForChild("PlayerPad8")
local Frame = script.Parent.HostUI.Frame

PP.Triggered:Connect(function(player)
	Pad1:Clone().Parent = game.Workspace
	Pad2:Clone().Parent = game.Workspace
	Pad3:Clone().Parent = game.Workspace
	Pad4:Clone().Parent = game.Workspace
	Pad5:Clone().Parent = game.Workspace
	Pad6:Clone().Parent = game.Workspace
	Pad7:Clone().Parent = game.Workspace
	Pad8:Clone().Parent = game.Workspace
	game.Workspace.StadiumPlatform:Remove()
	player.Character.HumanoidRootPart.CFrame = CFrame.new(workspace:WaitForChild("PlayerPad1").PlayerPlate.Position) or
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad2").PlayerPlate.Position) or
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad3").PlayerPlate.Position) or 
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad4").PlayerPlate.Position) or 
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad5").PlayerPlate.Position) or 
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad6").PlayerPlate.Position) or 
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad7").PlayerPlate.Position) or 
		player.Character.HumanoidRootPart.CFrame == CFrame.new(workspace:WaitForChild("PlayerPad8").PlayerPlate.Position)
	player.Character.Humanoid.WalkSpeed = 0
	player.Character.Humanoid.JumpHeight = 0

	Frame:TweenPosition(
		UDim2.new(0, 10, 0.01, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Quint,
		1,
		false)
	Frame.Visible = true
end)

the local script inside the cancel match buttom:

local StarterGUI = script.Parent.Parent.Parent
local CancelMatch = StarterGUI.Frame.Cancel
local Frame = StarterGUI.Frame
local Base = game.Workspace.StadiumPlatform
local PP = Base.GoldTrophy.Mogus
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

CancelMatch.MouseButton1Down:Connect(function()
	game.Workspace:WaitForChild("PlayerPad1"):Remove()
	game.Workspace:WaitForChild("PlayerPad2"):Remove()
	game.Workspace:WaitForChild("PlayerPad3"):Remove()
	game.Workspace:WaitForChild("PlayerPad4"):Remove()
	game.Workspace:WaitForChild("PlayerPad5"):Remove()
	game.Workspace:WaitForChild("PlayerPad6"):Remove()
	game.Workspace:WaitForChild("PlayerPad7"):Remove()
	game.Workspace:WaitForChild("PlayerPad8"):Remove()
	Base:Clone().Parent = game.Workspace
	
	player.Character.HumanoidRootPart.CFrame = CFrame.new(workspace.CancelMatchTP.Position)
	player.Character.Humanoid.WalkSpeed = 16
	player.Character.Humanoid.JumpHeight = 7.2
	
	Frame:TweenPosition(
		UDim2.new(0, 10, -0.4, 0),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Quint,
		1,
		false)
	wait(1)
	Frame.Visible = false
end)

how do i make it so it does the same process (same at the start of the video) everytime?

3 Likes

Did you have any errors after you triger pp for secont time?

I thing maybe it’s because is for:

You are likely making the frame visible from the server and since the server can see client changes,
and then making it invisible only for clien when you run it again the server still sees the frame as visible and then nothing happens.

I don’t know because i don’t know Frame is for? Can you tell me what is this Frame
I just searched for your problem on another topic and this is the isue but I don’t know

2 Likes

the frame is basically the same thing that appears in the video when u host the match, the one with Players: 1/8, process, invite players, cancel match

1 Like

But can you tell me did you have any errors in output after you triger pp for secont time

1 Like

no i didnt have any errors in the output

1 Like

I think i found why didn’t work for secont time after triger pp for secont time

the main script:
So we don’t need to remove and clone the StadiumPlatform just make it invisible
Put the script on position off a game.Workspace.StadiumPlatform:Remove() and remove game.Workspace.StadiumPlatform:Remove()

for i,v in pairs(game.Workspace.StadiumPlatform:GetDescendants()) do 
				if v:IsA("BasePart") or v:IsA("Part") then
					v.Transparency = 1
                                        PP.Enabled = false
				end
			end

local script:
remove Base:Clone().Parent = game.Workspace and put the script as the same position as Base:Clone().Parent = game.Workspace

for i,v in pairs(game.Workspace.StadiumPlatform:GetDescendants()) do 
				if v:IsA("BasePart") or v:IsA("Part") then
					v.Transparency = 0
                                        PP.Enabled = true
				end
			end

Sory for my bad english but tell me if this works and if the is any on output tell me!

First of all, I heavily suggest reading about loops because of how many lines it takes to define the playerpads (Loops)
Second, I assume that the proximity prompt is put in the stadium platform, is removed on the server, but added back on the local script. Since its gone from the server, the proximity prompt only exists on your client, which is only what you see. Try switching between client/server mode on the test tab
If you don’t understand something, feel free to ask :+1:

1 Like

Yeah that is corect

but i think maybe you just don’t need to remove anything just need to make them invisible/visible by remote events needs to be fired on server(Main script) to player(local script) and make them invisible/visible to client and proximity disabaled/enabled to client!

these scripts is for example how to call multiple parts at once without using multiple locals and etc!

and again sorry for my bad english

1 Like

it works but when i do it again the frame doesnt show up

But did you make it with remote events end etc that i say?

Can you do this if you can’t, i can help

so i need to make it with a remote event, where in it i will just put the server script, right?

I will make roblox file .rbxl file that cointains script and remote events so you don’t have to make everything

oh ok, are u already doing it?

1 Like

Sorry for the delay this is the file
Base.rbxl (36.9 KB)

thx for that, i changed it a little bit to make it work

1 Like