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)
Do you have filtering enabled turned on, if so... (I can't seem to comment - probably because of my low reputation so I can only say it here):
I've read about such situations before and have experienced it first hand and and I can likely tell you that this is as in studio, the local scripts act as normal scripts. So if you have filtering enabled, since local scripts can't communicate with the server, anything that changes the server should not work in the real game.
In your script:
local fire = Instance.new("Fire") fire.Parent = torso fire.Enabled = false fire.Heat = 6 fire.Size = 6
These things are the ones that has to be created by the server so that everyone see it, thus, it is most probably this that causes the local script to stop working. Note: Only if you have filtering enabled.
Solution: Personally, I would create a remote event to communicate with a server script to do it.