Script completely lost of functionality

I’m trying to organize my code so that it’s not confusing in the future, but everything is broken now and whenever I try to access a value in the Variables module nothing happens(printing doesn’t work).

Note: I’m supposed to be able to pick up bananas and eat them and there is supposed to be an animated ViewModel on screen.

Main Client
local Variables = require(script.Variables)

Variables.Bindables.OnClient.Event:Connect(function(signal,par1,par2)
	if signal == "EnableViewModel" then
		print("Success")
		Variables.RenderSteps:EnableViewModel(Variables.Controller)
		Variables.RenderSteps:AnimateViewModel(Variables.Controller)
	elseif signal == "EatBanana" then
		local length = Variables.Controller:RewardBanana()
		Variables.Rig:Destroy()
		Variables.Bindables.OnClient:Fire("ClearInventory")
		Variables.SoundPlayer:PlaySound("EatBananaSound",Variables.Root)
	end
end)

Variables.Bindables.ToClient.OnClientEvent:Connect(function(signal,par1,par2)
	if signal == "RigBanana" then
		Variables.Rig.new(Variables.Player,par1):Init()
	end
end)
Variables Module
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Client = script.Parent

local Variables = {}

Variables.Player = game:GetService("Players").LocalPlayer
Variables.Character = Variables.Player.Character or Variables.Player.CharacterAdded:Wait()
Variables.Root = Variables.Character.HumanoidRootPart
Variables.Humanoid = Variables.Character.Humanoid

Variables.SoundPlayer = require(Client.SoundPlayer)
Variables.Contexts = require(Client.Contexts)
Variables.Collections = require(Client.Collections)
Variables.RenderSteps = require(Client.RenderSteps)
Variables.Rig = require(Client.Rig)
Variables.Controller = require(Client.Controller).new()

Variables.Remotes = ReplicatedStorage.Remotes
Variables.Animations = ReplicatedStorage.Animations
Variables.Bindables = ReplicatedStorage.Bindables

return Variables

1 Like

Try making it a metatable, might help.

Are there any errors in the console? Edit: nvm

They don’t want that to be a metatable, it’s just meant to be a shared table of sorts I’m guessing

I’m just gonna revert back to an old version and try again. It’s better than a completely broken game.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.