I have a pretty big script here, and it took me forever to make it. Its 2 scripts split up by LocalScripts. I've tested it in Studio, and it works perfectly. Yet, when i play the actual game, it start making up problems. Here is the code now. Its 1 local script in StarterGui
local UIS = game:GetService('UserInputService')
local pressing
local Energy = 90
local player = game.Players.LocalPlayer
local character = player.Character
local PrettyColor = false
if not player or not character.Parent then
character = player.CharacterAdded:wait()
end
local torso = character.LowerTorso
local fire = Instance.new("Fire")
fire.Parent = torso
fire.Enabled = false
fire.Heat = 6
fire.Size = 6
UIS.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.C then
pressing = true
while pressing do
wait(.2)
Energy = Energy + 1
fire.Enabled = true
if PrettyColor == false then
fire.Color = Color3.new(255,255,255)
fire.SecondaryColor = Color3.new(255,255,255)
PrettyColor = true
end
_G.GetEnergy(Energy)
print('Charging....')
end
end
fire.Enabled = false
end
end)
UIS.InputEnded:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.C then
pressing = false
print('u stopped pressing :)')
fire.Enabled = false
end
end
end)

3 comments
I used to have it in 2 scripts, and they communicated by _G. But the GameRun decided it doesnt work anymore. Said i was trying to call a nil value of a function. So, i merge the scripts together (i wish they stayed seperate) and now its saying that LowerTorso isnt a valid member of Model (line 10)
As far as I know, the CharacterAdded:Wait() event never seems to work in-game. This is what I'd do: "repeat wait () until plr.Character and plr.Character:FindFirstChild("HumanoidRootPart")"
Are you sure that will work 100%?