Can anyone convert from RBLX to Buildism?
#1
Hoping someone can, I don't mind if you can't.
...
function onTouch(hit)
hit.Parent:kill()
end
script.Parent.Touched:connect(onTouch)
I'm an admin for the Wiki.
I own the most visited game in Buildism. Smile
[Image: epic1.png]
Reply
#2
function onCollide(part)
if part.Parent:isA("Character") then
part.Parent.Health = 0
end
end

link(script.Parent.Collided, onCollide)
Reply
#3
There :

Code:
function onTouch(part)
    if part.Parent:isA("Character") then
        part.Parent.Health = 0
    end
end

link(script.Parent.Collided, onTouch)
Reply
#4
I kind of like anonymous functions better

Code:
link(script.Parent.Collided,
function(p)
    print("Anonymous functions, for the win!")
    pcall(function()
        p.Parent.Health = 0
    end
end)
Reply
#5
You need the Parent:isA("Character"), otherwise your script will break if the part hits something that's not a character.
Reply
#6
(02-11-2011, 12:48 AM)Jacob_ Wrote: You need the Parent:isA("Character"), otherwise your script will break if the part hits something that's not a character.

Protected Call (PCall) can runs a function in a protected mode where it will catch any errors, if none, it runs the code. So basically, anything that 'breaks' defined in PCall's first arguement will not affect the scripts ability to run.
Reply
#7
If anyone needs more help with converting Lua from ROBLOX to Buildism, go here: http://buildism.net/wiki/w/index.php?tit...ildism_Lua
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)