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
-
LIVE
Grant Stinchfield
42 minutes agoRFK Jr. Ousts FDA’s Peter Marks—A Win for Medical Freedom and Government Accountability!
145 watching -
LIVE
The Dana Show with Dana Loesch
29 minutes agoThe Dana Show LIVE on Rumble! | 04-01-25
268 watching -
LIVE
Viss
2 hours ago🔴LIVE - PUBG Fueled with Tactics, Adrenaline, and Gasoline! - PUBG
269 watching -
LIVE
Benny Johnson
1 hour agoELECTION-MAGEDDON: Trump Vs. Obama 2028?! Third Term Matchup | MAGA on The Ballot
5,597 watching -
1:01:21
VINCE
4 hours agoScott Presler On The Ever-Important Wisconsin Election | Episode 12 - 04/01/25
192K136 -
LIVE
LFA TV
14 hours agoLFA ALL DAY LIVE STREAM 4/1/25
3,717 watching -
57:23
BonginoReport
6 hours agoEpstein Victim Reportedly on Deathbed—Still No Files - Early Edition w/Evita (Ep.172) - 04/01/2025
129K206 -
2:05:59
Matt Kohrs
9 hours agoApril Fools Market Trickery, Breaking News & Trading $1M || The MK Show
38.6K1 -
2:58:37
Wendy Bell Radio
7 hours agoIt's Another Bad Day To Be A Liberal In America
68.8K37 -
1:20:05
Dear America
13 hours agoElon Accused Of Shorting Child Support?! + Trump Hosts Kid Rock & AG Bondi Sends STRONG Warning!
68K12