It isn’t, one is a dot ( . ) the other a colon ( : ).
One just does a member access, the other does a member access and passes self as the first argument.
It’s not the same.
Look closer, it’s :
and .
They look really similar between quotes tho.
When you use the dot (.
) to call a function (e.g., module.EnableJoints(args)
), the function just receives the arguments you pass to it.
function module.EnableJoints(arg1)
--
end
module.EnableJoints("Hello")
Here, EnableJoints
gets "Hello"
as the argument arg1
.
When you use the colon (:
), Lua automatically passes the table (module) as the first argument to the function, followed by any other arguments.
function module:EnableJoints(arg1)
-- 'self' refers to the module itself
print(self) -- This prints the module
print(arg1) -- This prints "Hello"
end
module:EnableJoints("Hello")
In this case, self
(the module) is automatically passed as the first argument, and "Hello"
is passed as the second argument (arg1
).
(correct me if wrong)
I have tried this but now whenever i reset character, the humanoid breaks all of its joints when in a function earlier in the script
function RagdollService.SetUpHumanoid(character)
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.BreakJointsOnDeath = false
Humanoid.RequiresNeck = false
end
It was working when i used : instead
nevermind i was forgetting to check inside the player model
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.