17.1 Создаем локальные скрипты.


-- Создание события по клику на кнопке
script.Parent.Size = UDim2.new(0.05, 0, 0.10, 0)
script.Parent.MouseButton1Click:Connect(function()
	local newPositionX = math.random(0, 80) / 100
	local newPositionY = math.random(0, 80) / 100
	script.Parent.Position = UDim2.new(newPositionX, 0, newPositionY, 0)
	game.ReplicatedStorage.RemoteEventAnswer:FireServer()

end)
			

17.2 Создаем скрипт обновления времени.


--обновляем время
while wait(0.1) do
	script.Parent.Text = game.Players.LocalPlayer.CashStats.time.Value
	game.Players.LocalPlayer.CashStats.time.Value = game.Players.LocalPlayer.CashStats.time.Value - 5
	if game.Players.LocalPlayer.CashStats.time.Value <= 0 then
		local newPositionX = math.random(0, 80) / 100
		local newPositionY = math.random(0, 80) / 100
		script.Parent.Position = UDim2.new(newPositionX, 0, newPositionY, 0)
		game.Players.LocalPlayer.CashStats.time.Value = 100
	end
end
			

17.3 Создаем кнопку закрытия окна


--создаем кнопку закрытия окна
local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	plr.PlayerGui.ScreenGui_osu.Frame_osu.Visible = false
	plr.PlayerGui.ScreenGui_menu.Enabled = true
	plr.PlayerGui.ShopGui.Enabled = true
end)
			

17.4 Создаем скрипт обновления очков.


--обновление очков
while wait(0.01) do
	script.Parent.Text = game.Players.LocalPlayer.CashStats.Cash.Value.." $"
end