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
Roblox Studio Tutorials
3 years ago $0.02 earnedKnockback | Roblox Studio
3043 -
LIVE
Total Horse Channel
1 hour agoSacred Horses: Culture, Legacy & the Story Behind Sacred Dog
33 watching -
51:09
stevemorrisengines
10 hours ago $0.29 earnedThe “Better Half” Runs Her First 6 second 1/4 Mile ?
4.97K -
LIVE
I_Came_With_Fire_Podcast
20 hours agoBread & Circuses Aren't Free Anymore
93 watching -
4:39
Rethinking the Dollar
10 hours agoThe Great Employment Hoax: 1M Jobs Just Vanished!
17.6K6 -
9:14
Freedom Frontline
11 hours agoMartha MacCallum Leaves Hakeem Jeffries Speechless Over ICE Arrests
16.8K12 -
2:29:21
Barry Cunningham
3 hours agoLIVE NEWS: President Trump And Melania End The Day On A Good Note! Enough With Insanity And Drama!
40.1K4 -
1:49:17
The Mike Schwartz Show
5 hours agoTHE MIKE SCHWARTZ SHOW Evening Edition 02-11-2026
25.2K3 -
26:37
Dad Saves America
3 hours ago $0.99 earnedArthur Brooks: Marriage Is the Real Red Pill
19.7K2 -
1:02:55
TheCrucible
6 hours agoThe Extravaganza! EP: 95 with guest host Rob Noerr (02/11/26)
111K9