touchingFire variable getting jjammed at true

So you have a variable called:

local touchingFire = isTouchingFire.Value

This variable will remain static and not change so what I suggest you doing is set the touchingFire Variable to:

local touchingFire = isTouchingFire

and whenever you want to retrieve the value you do

touchingFire.Value

Are you referring to the first prototype of his program?
I noticed that, too, but it does not become an issue in his code.
Every time he wants to retrieve it, he does so correctly.

speakin of whch, have you found anything that could make the
event:FireClient(game.Players:FindFirstChild(player.Name), false) not trigger correctly?

I’m working on it. It’s weird because it looks like it should run correctly. I’ll keep looking over it.

i believe it has something to do with this

if not isPartOfPlayerInHitbox then
	print(player.Name)
	event:FireClient(game.Players:FindFirstChild(player.Name), false)
	table.remove(touchingPlayers, index)
end

i feel like this isn’t properly triggering, thus causiing the event not to fire. there aren’t any errors with the code as far as i know of.

Does the printing of player.Name work before the event is fired?

yes, somehow for both ways, line 15 and 35. though they don’t fire consistently

How not consistently do you mean?

every lucky while. this is another reason i think its the code i mentioned above not working, if it does work, it works like a charm, if it doesn’t… you know the drill. i have been at this one thing since 11 am this morning. its currently 9:30 pm

Well, that leads me to think it could be an issue with collision detection, which is something I have suspected for a while, particularly because .Touched is not the most reliable.
Although .Touched is mostly reliable for stationary targets, so it would confuse me why it would be an issue (unless your fires are moving around).

1 Like

agreed, these fires are primarily staionary, and only to provide heat.

1 Like

Okay, could you send both the client and server scripts once more.
I’m just gonna keep looking over them until I find what in the world is going on; it’s starting to bother me, too. :sob:

1 Like

NOW YOU HAVE A SLIGHT FEEL AS TO HOW I AM FEELING, THIS IS TAKING ME OVER 10 HOURS OF STOP AND START DEBUGGING (blame the stop and start on my ADHD)

1 Like

If you are willing to give my script a shot with your initial code.

Client:

local Player = game:GetService("Players").LocalPlayer
local heat = 100
local maxHeat = 100
local isTouchingFireValue = Player.PlayerGui:WaitForChild("IsTouchingFire")
local runService = game:GetService("RunService")

local function updateHeatUI()
	script.Parent.Size = UDim2.new(math.clamp(heat / maxHeat, 0, 1), 0, 1, 0)
	print(heat .. "/" .. maxHeat)
	print(isTouchingFireValue.Value)
end

runService.Heartbeat:Connect(function(deltaTime)
	if isTouchingFireValue.Value then
		heat = math.clamp(heat + 2 * deltaTime, 0, maxHeat)
	else
		heat = math.clamp(heat - 1 * deltaTime, 0, maxHeat)
	end

	updateHeatUI()
end)

Server:

local firebox = script.Parent
local Players = game:GetService("Players")

local touchingPlayers = {}

function onTouched()
    local currentlyTouching = {}
    for _, Part in pairs(firebox:GetTouchingParts()) do
        
        local Player = Players:GetPlayerFromCharacter(Part.Parent)
        
        if Player and not table.find(currentlyTouching, Player) then
            table.insert(currentlyTouching, Player)
        end
    end
    
    for _, Player in ipairs(touchingPlayers) do
        local IsTouchingFire = Player.PlayerGui:FindFirstChild("IsTouchingFire")

        if not IsTouchingFire then continue end
        if table.find(currentlyTouching, Player) then
            IsTouchingFire.Value = true
        else
            IsTouchingFire.Value = false 
        end
    end
    touchingPlayers = currentlyTouching
end

firebox.Touched:Connect(onTouched)
firebox.TouchEnded:Connect(onTouched)
1 Like

the issue is is that i am using an event not a value.

1 Like

Isn’t your initial code a boolean?

1 Like

plus, @NoodleXVIII is working on a solution rn

2 Likes

yeah, that was the prototype i used back in the morning

You sure you dont wanna try? I can assure you it’ll work :wink:

I keep looking over it and I just can’t seem to find an issue with the server script.
However, I keep coming back to that error regarding bool.
I can almost swear that you have to check if it’s not nil and then change touchingFire to bool.
But if it doesn’t work, then I really am starting to have no idea.
:sob: