Self and :Functions()

Hi! I was wondering if is posible to make Custom :Function(). For example:

function :ChangeColor(color)
   self.BrickColor = color
end)

--Script
part:ChangeColor("Red")
  • part would change its color to red.
function :AllowFalldamage()
   if self:IsA("Humanoid") then
       <FallDamageCode>
   end
end 

-- Script 
game.Players.PlayerAdded:Connect(function(plr)
   plr.Character.Humanoid:AllowFalldamage()
end)
  • Player when will fall Down he will get damage

Metatables must be the thing you are looking for!

1 Like

I believe this is what you mean

Adding a custom function to an instance might be a hard thing to do. You might as well try to replace it with function inside the script.

 function ChangeColor(Part,Color)
Part.BrickColor = Color
end

ChangeColor(Part,"Red")

Although this is only a suggestion, we cannot say that its impossible to add a custom :Function()

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.