Fire Call Handler

Hello DevFourm. I am trying to create an automatic fire call handler.

I have a server script that will update a UI with call details:

local Frame = CallDetail.Frame
local Title = Frame.Title
local Reason = Frame.Reason

local TitleString = game:WaitForChild("ReplicatedStorage"):WaitForChild("Title")
local ReasonString = game:WaitForChild("ReplicatedStorage"):WaitForChild("ReasonTitle")
local IsActiveFireCall = game:WaitForChild("ReplicatedStorage"):WaitForChild("ActiveFireCall")

Frame.visible = false

while true do 
	wait(1)

	-- check to see if there is active call title, if there is change the title to it

	if TitleString.Value == "none" then
	else 
		Title.Text = TitleString
	end

	-- check to see if there is acitve call reason, if there is cahnge the reason to it

	if ReasonString.Value == "none" then 
	else 
		Reason.Text = ReasonString
	end

	wait(1)

	-- if there is a active fire call send the frame
	if IsActiveFireCall == true then
		Frame.Visible = true 
	else 
		Frame.Visible = false
	end

	wait(10)
end

Then I have another server script that will create the calls. I have an example fire call for right now:

local TitleString = game:WaitForChild("ReplicatedStorage"):WaitForChild("Title")
local ReasonString = game:WaitForChild("ReplicatedStorage"):WaitForChild("ReasonTitle")
local IsActiveFireCall = game:WaitForChild("ReplicatedStorage"):WaitForChild("ActiveFireCall")

IsActiveFireCall.Value = false

-- Create a fire for a house
local house = workspace.PossibleHouseFire1 
local FirePart1 = house.FireModel.Fire1
local FirePart2 = house.Fire2
local FirePart3 = house.Fire3
local FirePart4 = house.Fire4

	
local SmokePart1 = house.Roof.Smoke1
local SmokePart2 = house.Roof.Smoke2
local SmokePart3 = house.Roof.Smoke3
local SmokePart4 = house.Roof.Smoke4


FirePart1.Transparency = 1
FirePart2.Transparency = 1
FirePart3.Transparency = 1
FirePart4. Transparency = 1

SmokePart1.Enabled = false
SmokePart2.Enabled = false
SmokePart3.Enabled = false
SmokePart4.Enabled = false



while true do 
	
wait(math.random(5, 10))
	
	if IsActiveFireCall == true then
		print('active fire call')
	else 
		FirePart1.Transparency = 0
		FirePart2.Transparency = 0
		FirePart3.Transparency = 0
		FirePart4. Transparency = 0

		SmokePart1.Enabled = true
		SmokePart2.Enabled = true
		SmokePart3.Enabled = true
		SmokePart4.Enabled = true
		print('starting fire.')
	end
	IsActiveFireCall.Value = true
	TitleString.Value = "Housing Fire."
	ReasonString.Value = "A brookside housing development house has caught fire."
end

This issue I am having is the call information not updating nor disappearing at the start before the call.

1 Like
-- if there is a active fire call send the frame
if IsActiveFireCall.Value == true then
	Frame.Visible = true 
else 
	Frame.Visible = false
end

Might be what you are looking for. /|\

Also shouldn’t the isactivefirecall value be set to true inside the else statment? Otherwise a new fire will be started whenever the while true statement runs. Where exactly is the Firecall being disabled btw… does it just run forever?

I see a few issues:

  1. As soon as this script runs, it will call the fire. To prevent this, you could just move the entire while loop after the smoke/fire disabling.
  2. On the first line of the client script, you are setting the visibility to false. This means that even after the script is run, the frame will be invisible.
  3. On the first script, you aren’t using the true/false value of the IsActiveFireCall property. You are just checking if the value is true.
  4. On the first script, you are setting the title and reason to the strings themselves, not the value of the strings.

Here is a fixed version:

local Frame = CallDetail.Frame
local Title = Frame.Title
local Reason = Frame.Reason

local TitleString = game:WaitForChild("ReplicatedStorage"):WaitForChild("Title")
local ReasonString = game:WaitForChild("ReplicatedStorage"):WaitForChild("ReasonTitle")
local IsActiveFireCall = game:WaitForChild("ReplicatedStorage"):WaitForChild("ActiveFireCall")

while true do
    wait(1)
    -- check to see if there is active call title, if there is change the title to it
    if TitleString.Value ~= "none" then
        Title.Text = TitleString.Value
    end
    -- check to see if there is acitve call reason, if there is cahnge the reason to it

    if ReasonString.Value ~= "none" then
        Reason.Text = ReasonString.Value
    end
    wait(1)
    -- if there is a active fire call send the frame
    if IsActiveFireCall.Value == true then
        Frame.Visible = true
    else
        Frame.Visible = false
    end
    wait(10)
end
local TitleString = game:WaitForChild("ReplicatedStorage"):WaitForChild("Title")
local ReasonString = game:WaitForChild("ReplicatedStorage"):WaitForChild("ReasonTitle")
local IsActiveFireCall = game:WaitForChild("ReplicatedStorage"):WaitForChild("ActiveFireCall")

IsActiveFireCall.Value = false

-- Create a fire for a house
local house = workspace.PossibleHouseFire1
local FirePart1 = house.FireModel.Fire1
local FirePart2 = house.Fire2
local FirePart3 = house.Fire3
local FirePart4 = house.Fire4


local SmokePart1 = house.Roof.Smoke1
local SmokePart2 = house.Roof.Smoke2
local SmokePart3 = house.Roof.Smoke3
local SmokePart4 = house.Roof.Smoke4


FirePart1.Transparency = 1
FirePart2.Transparency = 1
FirePart3.Transparency = 1
FirePart4. Transparency = 1

SmokePart1.Enabled = false
SmokePart2.Enabled = false
SmokePart3.Enabled = false
SmokePart4.Enabled = false

while true do
   wait(math.random(5, 10))

   if IsActiveFireCall.Value == false then
      FirePart1.Transparency = 0
      FirePart2.Transparency = 0
      FirePart3.Transparency = 0
      FirePart4. Transparency = 0

      SmokePart1.Enabled = true
      SmokePart2.Enabled = true
      SmokePart3.Enabled = true
      SmokePart4.Enabled = true
      print('starting fire.')
   end
   IsActiveFireCall.Value = true
   TitleString.Value = "Housing Fire."
   ReasonString.Value = "A brookside housing development house has caught fire."
end

Let me know if it works :slightly_smiling_face:

This would would but I’m trying to change the Ttile and Reason text box to the strings value.

It displays the UI but without the correct information.

It would be really helpful if you could share the output for the error, thank you :slightly_smiling_face:

There is no error. Thanks in advance.