Quicktime Event, How to do It?

Hello!

I have been wondering how to script Quicktime event.

Example:
You got bar. That bar will appear and player gotta react and click It when red line is in white square. Else player will fail.

Same mechanic as in Cryptik.

Or in Flee the Facility.

3 Likes

I have been working on same thing, but I have problem that it doesn’t always detect it player clicks when it’s on white point, I can give you unfinished script

there you go:

--so I binded it for Q. whenever player presses Q it fires remote event, and in
--server script it checks if player is on skill check(I call those like this) and 
--if the red line is on the white point(I hope it's understandable)

--[[LOCAL SCRIPT]]--
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
repeat wait(0.5) until game:IsLoaded()

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Q then
		game:GetService("ReplicatedStorage").SkillCheck:FireServer() --make remote event for it
	end
end)

--[[SERVER SCRIPT]]--
--Server script checks if everything was done correctly, and there are 2 functions
--If you want to make it show, you need to call function skillCheck()
--also, sorry for impossibly long lines
local RS = game:GetService("ReplicatedStorage")


local function acceptSkillCheck(player)
    local onskillcheck  = false
	local gui = player:WaitForChild("PlayerGui")
	local skillChecks = gui.RepairingUI.SkillCheck --variable to the skill checks gui, if you want, you can make it look like I have it
	local object --not needed, but maybe this can help later
    if skillChecks.Enabled == true then -- I have no idea how else I can check it
        onskillcheck = true
    end
	if onskillcheck == true then
		onskillcheck = false
		if math.random(1,3) == 1 then
			skillChecks.Image = "rbxassetid://5620612256" --I made some images for it, it picks one random.
			if skillChecks.Time.Rotation == 85 or skillChecks.Time.Rotation == 90 or skillChecks.Time.Rotation == 95 or skillChecks.Time.Rotation == 100 or skillChecks.Time.Rotation == 105 or skillChecks.Time.Rotation == 110  or skillChecks.Time.Rotation == 115 then
			else
				  --Here you can make something happen whenever player fails
			end
		elseif math.random(1,3) == 2 then
			skillChecks.Image = "rbxassetid://5620902523"
			if skillChecks.Time.Rotation == 305 or skillChecks.Time.Rotation == 310 or skillChecks.Time.Rotation == 315 or skillChecks.Time.Rotation == 320 or skillChecks.Time.Rotation == 325 or skillChecks.Time.Rotation == 330 or skillChecks.Time.Rotation == 335 or skillChecks.Time.Rotation == 340 or skillChecks.Time.Rotation == 345 or skillChecks.Time.Rotation == 350 or skillChecks.Time.Rotation == 355 or skillChecks.Time.Rotation == 360 then
			else
				  --Here you can make something happen whenever player fails
			end
		else
			skillChecks.Image = "rbxassetid://5620903802"
			if skillChecks.Time.Rotation == 230  or skillChecks.Time.Rotation == 235  or skillChecks.Time.Rotation == 240  or skillChecks.Time.Rotation == 245  or skillChecks.Time.Rotation == 250 or skillChecks.Time.Rotation == 255 or skillChecks.Time.Rotation == 260 or skillChecks.Time.Rotation == 265 or skillChecks.Time.Rotation == 270 then
			else
				  --Here you can make something happen whenever player fails
			end
		end
	end
end

RS.SkillCheck.OnServerEvent:Connect(acceptSkillCheck)

local function skillCheck(player)
        local onskillcheck = false
	local gui = player:WaitForChild("PlayerGui")
	local skillChecks = gui.RepairingUI.SkillCheck
	skillChecks.Visible = true
	onskillcheck = true
	wait(1)
	for i = 0, 360, 5 do
		skillChecks.Time.Rotation = i
		wait()
		if onskillcheck == false then --whenever player finishes doing it(presses Q), it will pause function
			skillChecks.Time.Rotation = 0 
			skillChecks.Visible = false
			return 
		end
	end 
	onskillcheck = false
	--Here you can make something happen if time runs out
	skillChecks.Time.Rotation = 0
	skillChecks.Visible = false
end

hope this helps!

1 Like

That would be great. I might find even why It doesn’t react always.

I think this has something with interpolation and a RunService.RenderStepped:Wait() to make it precise. Remember the client-server model has a slight delay between.

If you could provide me with GUI you used then It would be easier. So I can see It in action.

1 Like

I found errors in my script, I will try to fix them later