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

Modulescript not being called upon properly?

Asked by 7 years ago

I've been working on a game based around having first person combat with like swords and such and decided it would just be easier to have a tool modulescript to work faster but I'm having difficulties

local _T = {}

local Players = game:GetService("Players")
Tool = script.Parent

function _T.ThirdPerson()
    Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
end

function _T.FirstPerson()
    Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
end

return _T

that is the module script and my code to call upon it is:



local Players = game:GetService("Players") local ToolMod = require(game.Workspace.ToolMod) Tool.Equipped:connect(FirstPerson) Tool.Unequipped:connect(ThirdPerson)
0
I've tried doing this before. It doesn't work for me either. Just turn it into an anonymous function that calls the module script function in the block. UltimateRaheem 75 — 7y
0
Mainly my issue is you need to put the module nam before any line, aka _T.Players = game__________ and _T.Tool = Abstract_Life 65 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

You'll have to do ToolMod.FirstPerson(), that's all there's to it.

0
You want to pass the function not run it XD no need for the brackets. User#5423 17 — 7y
0
Ahh dumb mistake but it's my first time using a module script, thank you! Divagation 2 — 7y
Ad

Answer this question