I recently tried modules in my game so i could replace all of the same scripts easily without having to go through every script in the game. And that didn’t work?
The modulescript has no errors because it used to be a server script but i replaced it with a module.
Is there a solution to fix this? If you need the require() script thing here it is:
Server Script:
local ahmodule2 = game:GetService("ServerScriptService"):FindFirstChild("AngleHeadFlashlightGiver")
local ahmodule = require(angleheadmodule2)
ahmodule.activateGiver()
Module:
local module = {}
function module.activateGiver()
local rep = game:GetService("ReplicatedStorage")
local tools = rep:WaitForChild("ToolsStuff")
local straplight = tools:WaitForChild("FlashlightOrangeTorso")
local sStuff = tools:WaitForChild("StraplightStuff")
local secitemworkspace = workspace:FindFirstChild("SecondaryItemsWorkspace", true)
if not secitemworkspace then
warn("Bro didn't put the secondary item folder to the game, I'm off.")
return
end
script.Parent.Triggered:Connect(function(plr)
if plr:GetAttribute("OrangeFlashlightEquipped") ~= true then
--[[local sStuffC = sStuff:Clone()
sStuffC:MoveTo(Vector3.new(plr.Character:WaitForChild("UpperTorso").CFrame))
sStuffC.Parent = plr.Character]]
local straplightCloned = straplight:Clone()
local stHandle = straplightCloned:WaitForChild("ActualModel"):WaitForChild("Handle")
local stWeld = stHandle:WaitForChild("PlayerWeldedTo")
--straplightCloned:MoveTo(Vector3.new(plr.Character:WaitForChild("StraplightStuff"):WaitForChild("StraplightGoTo").CFrame))
--straplightCloned.ActualModel:MoveTo(Vector3.new(plr.Character:WaitForChild("StraplightStuff"):WaitForChild("StraplightGoTo").CFrame))
--stra = plr.Character:WaitForChild("StraplightStuff"):WaitForChild("StraplightGoTo").CFrame
straplightCloned.Parent = secitemworkspace
straplightCloned.Name = "OrangeFlashlight_".. plr.Name
straplightCloned:SetAttribute("Owner", plr.Name)
stWeld.Part1 = plr.Character:WaitForChild("UpperTorso")
plr:SetAttribute("OrangeFlashlightEquipped", true)
--straplightCloned.ActualModel.OtherParts:MoveTo(Vector3.new(straplightCloned.ActualModel.PrimaryPart.CFrame))
--stWeld.Part1 = plr.Character:WaitForChild("UpperTorso")
end
end)
end
return module