#Help with understanding this code

1 messages · Page 1 of 1 (latest)

molten nymph
#

does this part of the script :
local gate = gates:FindFirstChild(button.Name)
correspond to the button that has the same name as the gate?

local mg = game.Workspace:WaitForChild("Maingame")
local buttons = mg:WaitForChild("Button")
local gates = mg:WaitForChild("Gate")

local function ab(button, touched)
touched.Value = true
local gate = gates:FindFirstChild(button.Name)
if gate then
gate.Transparency = 0.5
gate.CanCollide = false
end

local duration = button:FindFirstChild("Duration")
local timer = duration.Value    

while timer>0 do
    print(timer)
    task.wait(1)
    timer -= 1        
end
gate.Transparency = 0
gate.CanCollide = true    

touched.Value = false    

end

for _, button in pairs(buttons:GetChildren()) do
button.Touched:Connect(function(otherpart)
local humanoid = otherpart.Parent:FindFirstChild("Humanoid")
local touched = button:FindFirstChild("Touched")
if humanoid and touched and touched.Value == false then
ab(button, touched)
end
end)
end

native yoke
molten nymph
frigid sandalBOT
#

studio** You are now Level 2! **studio

native yoke
# molten nymph then what is the right understanding of it?

i meant you got that literally backwards. lua local gate = gates:FindFirstChild(button.Name) does this correspond to the button that has the same name as the gate?

gates:find(button.name) so it's looking for a gate with the same name as the button, not what you said. unless you've shoved buttons into the gates folder for whatever reason and deliberately named it gates when it should actually be called buttons

molten nymph
#

ohhh I see

#

I understand now

#

Thank you

molten nymph
#

wait one more question, what is the best way to learn scripting in roblox studio? What are the lessons that I need to cover step by step?

grave lark
#

Search a beginner tutorial

#

Search for one explaining all key words too

native yoke
grave lark
#

Youre making a game engine insidr a game engine?

native yoke
molten nymph
native yoke
#

like... datastores, and the 30 concurrent request limit + bunch of other limits

#

and the badgeservice limit where if you have more than 85 badges you can't query them all at once when a player joins

grave lark
#

Thats specific

native yoke
#

code that deals with analyticsservice etc so i don't have to go chasing stuff out of the docs, i can just do player:dothing and it's all done for me

grave lark
#

Ooooooooohh

#

Thats very cool

grave lark
#

?

#

-# player.dothing / player:dothing

native yoke
native yoke
#

;compile lua lua local t={} t.x=5 t.f=function(self) print(self.x) end t.f(t) t.x=7 t:f() -- identical to t.f(t)

silk thunderBOT
#
Program Output
5
7

native yoke
#

with custom funnels you can only have 10 (plus the onboarding one)