So, I would like to have a moduleScript that has a function that does something to a player, and I need to pass in something about the player to the function. So far, I have this:
--Script:
local CollisionSphereModule = require(script.Parent:WaitForChild("CollisionSphere"))
CollisionSphereModule:addCollisionSphere(game.Workspace:WaitForChild("JoRyJuKy"))
--ModuleScript:
local module = {}
function module.addCollisionSphere(Character)
local player = game.Players:GetPlayerFromCharacter(Character)
print(player.Name)
end
return module
And so far, it returns this error:
--Unable to cast value to Object
--(From Line 4)
What I think is that the parameter I'm passing is being treated as a value instead of an object, like the error says. Is there any way I can remedy this?
Thanks, JoRyJuky

1 comment
Thanks! Works a treat!