This shall be my first script...
#1

--i <3 already knowing RBX.lua, i made this in a few seconds, and this is my first script
local deb = false
link(game.World.Button1.Collided, function(nope)
if nope.Name == "Body" and deb == false then
deb = true
game.World.Button1.Color = Color(0,255,0) --green
sleep(1)
dep = false
game.World.Button1.Color = Color(255,0,0) --red
end
end)
Reply
#2
Looks right to me... although you might want to start using [lua] tags.
Reply
#3
[lua]--i <3 already knowing RBX.lua, i made this in a few seconds, and this is my first script
local deb = false
link(game.World.Button1.Collided, function(nope)
if nope.Name == "Body" and deb == false then
deb = true
game.World.Button1.Color = Color(0,255,0) --green
sleep(1)
dep = false
game.World.Button1.Color = Color(255,0,0) --red
end
end)[/lua]
Reply
#4
That's one big link statement, I don't think it's supposed to be like that.
Let me try.


[lua]local deb = false
function onCollide(hit)
if hit.Name == "Body" and deb == false then
deb = true
game.World.Button1.Color = Color(0,255,0) --green
sleep(1)
deb = false
game.World.Button1.Color = Color(255,0,0) --red
end
end
link(game.World.Button1.Collided, onCollide)[/lua]

I think that's correct.
By the way, you misspelled "deb = false" and wrote "dep = false" towards the end.
Reply
#5
@Paradox


anonymous functions = efficiency
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)