Premium Only Content
 
			Scripting 101: Functions (Part 3) Click Detector Event with Function
In this Roblox Studio tutorial connect a function to make a staircase to an in game click detector. Since this is a continuation of the last video, I provide the script below from "Functions (Part 2)". Copy it, create a "script" in your workspace, and you will have everything you need.
----- steps from part 2 --------
local yPos = 0
local zPos = 0
local stepHt = 2
local stepDist = 3
local function makeStep(y, z)
wait(.2)
local part = Instance.new("Part", workspace)
part.Position = Vector3.new(0, y, z)
part.Size = Vector3.new(10, .5, 3)
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BottomSurface = Enum.SurfaceType.Smooth
part.BrickColor = BrickColor.Random()
local colorName = part.BrickColor.Name
return part, colorName
end
wait(6)
for i=1, 10, 1 do
yPos = yPos + stepHt
zPos = zPos + stepDist
local p1, cName = makeStep(yPos, zPos)
p1.Material = Enum.Material.DiamondPlate
print("color name = ", cName, "i = ", i)
end
- 	
				 12:48 12:48Roblox Studio Tutorials2 years ago $0.02 earnedKnockback | Roblox Studio2603
- 	
				 46:58 46:58Brad Owen Poker12 hours agoI Make QUAD ACES!!! BIGGEST Bounty Of My Life! Turning $0 Into $10,000+! Must See! Poker Vlog Ep 32332
- 	
				 2:52:28 2:52:28TimcastIRL3 hours agoSTATE OF EMERGENCY Declared Over Food Stamp CRISIS, Judge Says Trump MUST FUND SNAP | Timcast IRL172K106
- 	
				 DVR DVRTundra Tactical10 hours ago $14.19 earned🚨Gun News and Game Night🚨 ATF Form 1 Changes, BRN-180 Gen 3 Issues??, and Battlefield 6 Tonight!16.7K
- 	
				 1:45:13 1:45:13Glenn Greenwald7 hours agoJD Vance Confronted at Turning Point about Israel and Massie; Stephen Miller’s Wife Screams “Racist” and Threatens Cenk Uygur with Deportation; Rio's Police Massacre: 120 Dead | SYSTEM UPDATE #54087.4K96
- 	
				 LIVE LIVESpartakusLIVE4 hours agoSpart Flintstone brings PREHISTORIC DOMINION to REDSEC279 watching
- 	
				 1:05:02 1:05:02BonginoReport7 hours agoKamala CALLED OUT for “World Class” Deflection - Nightly Scroll w/ Hayley Caronia (Ep.167)106K69
- 	
				 54:36 54:36MattMorseTV5 hours ago $24.06 earned🔴The Democrats just SEALED their FATE.🔴41.3K81
- 	
				 8:07:01 8:07:01Dr Disrespect12 hours ago🔴LIVE - DR DISRESPECT - ARC RAIDERS - SOLO RAIDING THE GALAXY119K12
- 	
				 1:32:00 1:32:00Kim Iversen7 hours agoThe World’s Most “Moral” Army — Kills 40 Kids During "Ceasefire" | Socialism's Coming: The Zohran Mamdani Agenda96.8K176