Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Whats the other way of a function?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

I want to turn the scripts funtion below to something like: ex: script.Parent.Touched:connect(function() Something like that.

function lightOnFire(part)
    print("Going to light this part on fire:")
    print(part.Name)

    fire = Instance.new("Fire")
    fire.Parent = part
end

firePart = game.Workspace.FirePart

firePart.Touched:connect(lightOnFire)

function putOutFire(part)
    print("Got to put out the fire on:")
    print(part.Name)

    fire = part:FindFirstChild("Fire")
    if fire then
        fire:Destroy()
    end
end

waterPart = game.Workspace.WaterPart
waterPart.Touched:connect(putOutFire)

firePart.Transparency = 1
waterPart.Transparency = 1

1 answer

Log in to vote
0
Answered by 9 years ago

I think you mean this?

Part.Touched:connect(function(touchedPart)
    print(touchedPart.Name)
end)
0
Well has the funtion in the script I gave you been called? FiredDusk 1466 — 9y
Ad

Answer this question