(this is not the full script, i have cut out some pieces that i think it won't be needed, as when people see a lot of code they skip and don't help :/

Basically, everything works, the countdown goes to 0 and shows the keyword, when players press that keyword, they get a point. but then, the keyword won't change, it won't start again to: Showing keyword in:... then a Keyword, anyone knows why?

don't mind the end missing, i removed them to make script here shorter

Server Script

		-- game starting
		local givePoints = game.ReplicatedStorage.RoomsTable.RoomOne.GivePoints
		local theText = workspace.GameCubes.RoomOne.actText
		local t = 8	
		local showKey = game.ReplicatedStorage.RoomsTable.RoomOne.showKey
		local startAgain = game.ReplicatedStorage.RoomsTable.RoomOne.startAgain
			
		repeat	
			repeat
				t = t -1
				wait(1)
				theText.Value = "Revealing the key in:.."..t
			until t == 0
				showKey.OnServerEvent:Connect(function(player, randomKeyChosen)
					game.Workspace.GameCubes.RoomOne.RandomKey.Value =  randomKeyChosen
				end)
				theText.Value = workspace.GameCubes.RoomOne.RandomKey.Value
				givePoints.OnServerEvent:Connect(function(player)
					player.Points.Value = player.Points.Value + 1
			end)
				
		until RoomOnePlayers[1].Points.Value or RoomOnePlayers[2].Points.Value == 10

Local Script

local givePoints = game.ReplicatedStorage.RoomsTable.RoomOne.GivePoints
local UIS = game:GetService("UserInputService")
local allTheKeyWords = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}



local randomKey = allTheKeyWords[math.random(1, #allTheKeyWords)]	
local startAgain = game.ReplicatedStorage.RoomsTable.RoomOne.startAgain


print("The Random key is : "..randomKey)
local Player = game.Players.LocalPlayer

local showKey = game.ReplicatedStorage.RoomsTable.RoomOne.showKey
showKey:FireServer(randomKey)


UIS.InputBegan:Connect(function(key, whileTalking)
		if whileTalking then return end
	if key.KeyCode == Enum.KeyCode[randomKey] then
		print(game.Players.LocalPlayer.Name.." Pressed: "..key.KeyCode.Name)
		if Player:FindFirstChild("Points") then
		givePoints:FireServer()
		startAgain:FireServer()
		else
			print("Player is not on the game still")
		end
	end
end)

2 comments

0

Why use a repeat? Repeats are weird and are mostly un-used. I would suggest trying to use a while loop or a for loop instead!

0

same