0% found this document useful (0 votes)
113 views2 pages

Qte Script

This script implements a Quick Time Event (QTE) system in a Roblox game, where players must press a random key within a time limit to avoid taking damage. A GUI button displays the expected key, and if the player fails to press it in time, a damage event is triggered. The QTEs occur at random intervals between a minimum and maximum time set by the developer.

Uploaded by

neobotyt7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views2 pages

Qte Script

This script implements a Quick Time Event (QTE) system in a Roblox game, where players must press a random key within a time limit to avoid taking damage. A GUI button displays the expected key, and if the player fails to press it in time, a damage event is triggered. The QTEs occur at random intervals between a minimum and maximum time set by the developer.

Uploaded by

neobotyt7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

local player = [Link].

LocalPlayer
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")

local damageEvent = RS:WaitForChild("QTEDamage")

-- SETTINGS
local DAMAGE = 50
local MIN_TIME = 3
local MAX_TIME = 7
local QTE_TIME_LIMIT = 1.5

local keys = {
[Link].E,
[Link].Q,
[Link].F,
[Link].R
}

-- GUI
local gui = [Link]("ScreenGui")
[Link] = player:WaitForChild("PlayerGui")

local button = [Link]("TextLabel")


[Link] = [Link](0.1, 0.1)
button.BackgroundColor3 = [Link](255, 60, 60)
[Link] = true
[Link] = false
[Link] = gui
[Link] = [Link](0.5, 0.5)

local active = false


local expectedKey

-- FUNCTION TO START QTE


local function startQTE()
if active then return end
active = true

expectedKey = keys[[Link](#keys)]
[Link] = [Link]

[Link] = [Link](
[Link](10, 90) / 100,
[Link](10, 90) / 100
)

[Link] = true

local success = false

local connection
connection = [Link]:Connect(function(input, gp)
if gp then return end
if [Link] == expectedKey then
success = true
connection:Disconnect()
end
end)

[Link](QTE_TIME_LIMIT)

[Link] = false
if connection then connection:Disconnect() end

if not success then


damageEvent:FireServer(DAMAGE)
end

active = false
end

-- LOOP
[Link](function()
while true do
[Link]([Link](MIN_TIME, MAX_TIME))
startQTE()
end
end)

You might also like