Kalananti Game Coding Bootcamp - Fire Escape Game (10-12)

Source Code

ClickScript
local Button = game.Workspace.Stuffs.Button
local ClickDetector = Button.ClickDetector

local Door = game.Workspace.Stuffs.Door

function Clicked(player)
	Door.Transparency = 1
	Door.CanCollide = false
end

ClickDetector.MouseClick:Connect(Clicked)
DamageScript
local DamagePart = game.Workspace.CodingParts.DamagePart

function Touched(HitPart)
	local Character = HitPart.Parent
	local Humanoid = Character:FindFirstChild("Humanoid")

	if Humanoid then
		Humanoid:TakeDamage(100)
	end
end

DamagePart.Touched:Connect(Touched)
FinishScript
local Players = game:GetService("Players")
local FinishPart = game.Workspace.Spawns.Finish

function Touched(HitPart)
	local Character = HitPart.Parent
	local Player = Players:GetPlayerFromCharacter(Character)

	if Player then
		local PlayerGui = Player.PlayerGui
		local ScreenGui = PlayerGui.ScreenGui
		
		local TextLabel = ScreenGui.TextLabel
		
		TextLabel.Position = UDim2.fromScale(0.5, 1.5)
		
		ScreenGui.Enabled = true
		
		TextLabel:TweenPosition(
			UDim2.fromScale(0.5, 0.5),
			Enum.EasingDirection.Out,
			Enum.EasingStyle.Back,
			0.5,
			false
		)
	end
end

FinishPart.Touched:Connect(Touched)

Starter Project

Starter Project - Fire Escape Game 1012.rbxl (37.1 KB)