I have a tool, but to use the mouse function, it needs to be a local script. If I make it a local script, the global functions won't work. I can't think of a quick way to resolve this issue. The tool's script is:
localPlr = game.Players.LocalPlayer
gui = nil
function displayClass(plr,class)
if gui ~= nil then
gui:Destroy()
end
gui = script.Parent.ClassGUI:Clone()
gui.Background.Player.Text = plr.Name..":"
gui.Background.Class.Text = class
gui.Parent = localPlr.PlayerGui
end
script.Parent.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
local target = mouse.Target
if target == nil then
if gui ~= nil then
gui:Destroy()
end
return
end
local plr
if target.Parent:IsA("Model") and game.Players:FindFirstChild(target.Parent.Name) ~= nil and game.Players[target.Parent.Name]:IsA("Player") then
plr = game.Players[target.Parent.Name]
elseif target.Parent.Parent:IsA("Model") and game.Players:FindFirstChild(target.Parent.Parent.Name) ~= nil and game.Players[target.Parent.Parent.Name]:IsA("Player") then
plr = game.Players[target.Parent.Parent.Name]
elseif gui ~= nil or plr == nil then
gui:Destroy()
return
end
if _G.checkAsset(plr,"Supreme Investor") then
displayClass(plr,"Supreme Investor")
elseif _G.checkAsset(plr,"Investor") then
displayClass(plr,"Investor")
elseif _G.checkAsset(plr,"FirstClass") then
displayClass(plr,"First Class")
elseif _G.checkAsset(plr,"BusinessClass") then
displayClass(plr,"Business Class")
else
displayClass(plr,"Economy")
end
end)
end)
script.Parent.Unequipped:connect(function()
if gui ~= nil then
gui:Destroy()
end
end)

1 comment
What do you mean by global functions? Do you need to use module scripts?