![]()
When you hover your mouse over it, what does it say?
“Unknown require : Unsupported Path”
However, i verified this path and it still doesnt work
Have you tried printing the module? Maybe it’s nil? Try adding a :WaitForChild().
Yes, i have.
When printing the Modules Manually ( game.ReplicatedStorage.LocalizedHandles), it works perfectly
However when i try using the same path with the self table it throws the error. I have tried this same method Multiple times before with other services and it worked perfectly, I have also restarted studio it still throw the same error
Can you send me the part of the script that causes the error? Enough so it works till that point?
local Push = {}
Push.__index = Push
Push.new = function()
local self = setmetatable({},Push)
self.Services = { ["TS"] = game:GetService("TweenService"), ["Players"] = game:GetService("Players"), ["RS"] = game:GetService("ReplicatedStorage")}
self.InventoryHandler = require(self.Services.RS.LocalizedHandles.Functions.InventoryHandler)
self.Connections = {}
self.Properties = {
["BGT"] = 0.5, ["Visible"] = true, ["Size"] = UDim2.new(1,0,1,0), ["CR"] = UDim.new(0.1,0),
["TextScaled"] = true, ["BC3"] = Color3.fromRGB(0,0,0),
}
self.Tags = self.Services.Players.LocalPlayer.Tags.Value
self.Cost = 10
self.TLD = game:GetService("Players").LocalPlayer.PlayerGui
self.SLD = self.TLD:WaitForChild("UIs").GUI_Mains.Weapons.Inventory
self.FLD = self.SLD.WeaponsList.Buttons
self.UnlockingPrompt = self.SLD.UnlockingPrompt
self.MessagePrompt = self.SLD.MessageFrame
self.CH = self.UnlockingPrompt self.Timer = 0.35 self.Size = UDim2.new(0.456,0,0.316,0)
self.GlobalFunctions = {
Tween = function(Status)
if Status == "Start" then
local Tween = self.Services.TS:Create(self.CH,TweenInfo.new(self.Timer, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut),{Size = self.Size}) Tween:Play()
return Tween
elseif Status == "Return" then
local Tween = self.Services.TS:Create(self.CH,TweenInfo.new(self.Timer, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut),{Size = self.Size}) Tween:Play()
return Tween
end
end,
}
self.NewAbility = Instance.new("TextButton") self.NewAbility.Parent = self.FLD self.NewAbility.Name = "Push" self.NewAbility.Text = "Push"
self.Corner = Instance.new("UICorner") self.Corner.Parent = self.NewAbility self.Corner.CornerRadius = self.Properties.CR
self.Lock = Instance.new("TextLabel") self.Lock.Parent = self.NewAbility self.Lock.Name = "Lock" self.Lock.Size = self.Properties.Size
self.Lock.BackgroundColor3 = self.Properties.BC3 self.Lock.Text = "" self.Lock.BackgroundTransparency = 0.3 self.Lock.Visible = self.Properties.Visible
self.LCorner = self.Corner:Clone() self.LCorner.Parent = self.Lock
self.CDLabel = self.Lock:Clone() self.CDLabel.Parent = self.NewAbility self.CDLabel.Name = "CDLabel" self.CDLabel.Text = "10" self.CDLabel.Font = Enum.Font.Code self.CDLabel.TextScaled = self.Properties.TextScaled self.CDLabel.Visible = false
self.TConstraint = Instance.new("UITextSizeConstraint") self.TConstraint.Parent = self.CDLabel self.TConstraint.MaxTextSize = 50 self.TConstraint.MinTextSize = 1
self.NewAbility:SetAttribute("Locked",true)
self.Status = self.NewAbility:GetAttribute("Locked")
return self,self.NewAbility
end
return Push
I checked, and it doesn’t throw any error for me.
Try this:
self.Services = {["RS"] = game:GetService("ReplicatedStorage")}
print(self.Services.RS)
local LocalizedHandles = self.Services.RS:WaitForChild("LocalizedHandles")
local Functions = LocalizedHandles:WaitForChild("Functions")
local InventoryHandler = LocalizedHandles:WaitForChild("InventoryHandler")
print(LocalizedHandles,Functions,InventoryHandler)
self.InventoryHandler = require(InventoryHandler)
It’s just for debugging. Does it print all the way through properly?
No, It doesnt work for me suprisingly,
When i run the scirpt, the line “self.Services.RS” prints fines however when printing the other Line it throws an “Infinite yield” error on the Path and still underlines line 8 where “require” was used.
Oops, yeah, I made a typo. Sorry.
self.Services = {["RS"] = game:GetService("ReplicatedStorage")}
print(self.Services.RS)
local LocalizedHandles = self.Services.RS:WaitForChild("LocalizedHandles")
local Functions = LocalizedHandles:WaitForChild("Functions")
local InventoryHandler = Functions:WaitForChild("InventoryHandler") -- Had a typing error here.
print(LocalizedHandles,Functions,InventoryHandler)
self.InventoryHandler = require(InventoryHandler)
Same thing, it doesnt work. Restarted studio as well
When i do this
require(game.RepliactedStorage.LocalizedHandles.Functions.InventoryHandler)
it works, but doesnt work with the table
Can you tell me at which line it throws the warning of the script yielding? (Infinite yield warning.)
By this, you can already tell. The script is unable to get that instance. Could be a loading issue or it could be that the instance is being destroyed.
That was before the typo error was fixed and its loaded locally after the server has loaded, i added task.wait as well to ensure it was not loading issue, it throws the same error. and i ensured the instance wasnt destroyed
Well, it’s confusing to say the least.
What’s the hierarchy of the “LocalizedFunctions”? Like, children and descendants of it. What are they? Can you send a screenshot?
Hm…
All right, my question is, why do you have “Services” as a dictionary for self? Why not just have it assigned at the top of the module script like so?
local Push = {}
Push.__index = Push
local Services = { ["TS"] = game:GetService("TweenService"), ["Players"] = game:GetService("Players"), ["RS"] = game:GetService("ReplicatedStorage")}
Push.new = function()
local self = setmetatable({},Push)
self.InventoryHandler = require(self.Services.RS.LocalizedHandles.Functions.InventoryHandler)
self.Connections = {}
self.Properties = {
["BGT"] = 0.5, ["Visible"] = true, ["Size"] = UDim2.new(1,0,1,0), ["CR"] = UDim.new(0.1,0),
["TextScaled"] = true, ["BC3"] = Color3.fromRGB(0,0,0),
}
self.Tags = self.Services.Players.LocalPlayer.Tags.Value
self.Cost = 10
self.TLD = game:GetService("Players").LocalPlayer.PlayerGui
self.SLD = self.TLD:WaitForChild("UIs").GUI_Mains.Weapons.Inventory
self.FLD = self.SLD.WeaponsList.Buttons
self.UnlockingPrompt = self.SLD.UnlockingPrompt
self.MessagePrompt = self.SLD.MessageFrame
self.CH = self.UnlockingPrompt self.Timer = 0.35 self.Size = UDim2.new(0.456,0,0.316,0)
self.GlobalFunctions = {
Tween = function(Status)
if Status == "Start" then
local Tween = self.Services.TS:Create(self.CH,TweenInfo.new(self.Timer, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut),{Size = self.Size}) Tween:Play()
return Tween
elseif Status == "Return" then
local Tween = self.Services.TS:Create(self.CH,TweenInfo.new(self.Timer, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut),{Size = self.Size}) Tween:Play()
return Tween
end
end,
}
self.NewAbility = Instance.new("TextButton") self.NewAbility.Parent = self.FLD self.NewAbility.Name = "Push" self.NewAbility.Text = "Push"
self.Corner = Instance.new("UICorner") self.Corner.Parent = self.NewAbility self.Corner.CornerRadius = self.Properties.CR
self.Lock = Instance.new("TextLabel") self.Lock.Parent = self.NewAbility self.Lock.Name = "Lock" self.Lock.Size = self.Properties.Size
self.Lock.BackgroundColor3 = self.Properties.BC3 self.Lock.Text = "" self.Lock.BackgroundTransparency = 0.3 self.Lock.Visible = self.Properties.Visible
self.LCorner = self.Corner:Clone() self.LCorner.Parent = self.Lock
self.CDLabel = self.Lock:Clone() self.CDLabel.Parent = self.NewAbility self.CDLabel.Name = "CDLabel" self.CDLabel.Text = "10" self.CDLabel.Font = Enum.Font.Code self.CDLabel.TextScaled = self.Properties.TextScaled self.CDLabel.Visible = false
self.TConstraint = Instance.new("UITextSizeConstraint") self.TConstraint.Parent = self.CDLabel self.TConstraint.MaxTextSize = 50 self.TConstraint.MinTextSize = 1
self.NewAbility:SetAttribute("Locked",true)
self.Status = self.NewAbility:GetAttribute("Locked")
return self,self.NewAbility
end
return Push
I know this is more of a barebone solution but it got me curious as to why you have Services like that?
True, However i have done this same type of code multiple times before and it works perfectly so i predicted nothing could go wrong if i try the same tactic
And when i did assign the service at the top of the Modulescript it worked perfectly, Still confusing though, there should have been no problem when assigned to the table or at the top of the script
Wow, I guess that concludes that, for some reason, “self” is causing an issue. I’m not really an expert on OOP, so you might as well keep this topic open for anyone who’s an expert at OOP.
Although I can say that it doesn’t occur for me at all.
Have you tried doing the same in another place?
