← Back to Escape Room Scripts

Win Condition Script

Customize your variables, then fill in the blanks!

Your Custom Settings

Tool name in Workspace
Part name for the lock
ScreenGui in StarterGui
TextLabel inside the GUI

LocalScript (StarterGui)

This script shows a win message when the player touches the lock while holding the key. Create a Tool named "keyTool", a part named "lockTrigger", and a ScreenGui with a TextLabel (Visible = false)!

local player = game..
local keyTool = workspace:("keyTool")
local lockTrigger = workspace:WaitForChild("lockTrigger")
local winLabel = player:WaitForChild("").winGui.winLabel
lockTrigger.:Connect(function(hit)
    if hit.Name == "Handle" and hit. == keyTool then
        local character = player.
        if character and keyTool.Parent == character then
            winLabel. = true
        end
    end
end)