Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gui does not change text with proper script?

So basically when the fires pop up the gui text doesn't change. I wonder what the problem is. If someone could help me that would be amazing

local size = math.random(10 , 30)
local heat = math.random(10 , 20)-- change if you wish to 
local p = script.Parent.Position
local gui = game.StarterGui.ScreenGui
while true do
	wait(5)
	if script.Parent.Fire.Enabled == false then
		wait(math.random(1 , 10)) -- change
		script.Parent.Fire.Size = size
		script.Parent.Fire.Heat = heat
		script.Parent.Fire.Enabled = true
		script.Parent.Parent.other.Fire.Size = size
		script.Parent.Parent.other.Fire.Heat = heat
		script.Parent.Parent.other.Fire.Enabled = true
		script.Parent.Parent.other2.Fire.Size = size
		script.Parent.Parent.other2.Fire.Heat = heat
		script.Parent.Parent.other2.Fire.Enabled = true
		script.Parent.Parent.other3.Fire.Size = size
		script.Parent.Parent.other3.Fire.Heat = heat
		script.Parent.Parent.other3.Fire.Enabled = true
		script.Parent.Parent.Parent.Parent.StarterGui.ScreenGui.TextLabel.Text = "Fire"
		wait(5)
		gui.TextLabel.Text = "Test"
		print ("HOUSE FIRE!")
		size = script.Parent.Fire.Size + math.random(1 , 10) -- change this to what ever you want
		
		
	elseif script.Parent.Fire.Enabled == false then
		print("No current fires")

	end
end




1 answer

First of all, Scripts ran on the server should not change children in a Player object. Make sure to enable filtering on your game.

Script in ServerScriptService:

local RS = game:GetService("ReplicatedStorage")
local CodeValue = Instance.new("IntValue")
CodeValue.Value = math.random(1, 9999999) - - CodeValue is used to generate random codes to make it a LOT harder for exploiters to make FE scripts
local HouseFireEvent = Instance.new("RemoteEvent", RS)
HouseFireEvent.Name = "HouseFireEvent_FE"

local size = math.random(10 , 30)
local heat = math.random(10 , 20)-- change if you wish to 
local p = script.Parent.Position
while true do
    wait(5)
    if script.Parent.Fire.Enabled == false then
        wait(math.random(1 , 10)) -- change
        HouseFireEvent:FireAllClients()
        wait(5)
        script.Parent.Fire.Size = size
        script.Parent.Fire.Heat = heat
        script.Parent.Fire.Enabled = true
        script.Parent.Parent.other.Fire.Size = size
        script.Parent.Parent.other.Fire.Heat = heat
        script.Parent.Parent.other.Fire.Enabled = true
        script.Parent.Parent.other2.Fire.Size = size
        script.Parent.Parent.other2.Fire.Heat = heat
        script.Parent.Parent.other2.Fire.Enabled = true
        script.Parent.Parent.other3.Fire.Size = size
        script.Parent.Parent.other3.Fire.Heat = heat
        script.Parent.Parent.other3.Fire.Enabled = true
        print ("HOUSE FIRE!")
        size = script.Parent.Fire.Size + math.random(1 , 10) -- change this to what ever you want


    elseif script.Parent.Fire.Enabled == false then
        print("No current fires")

    end
end

LocalScript inside your ScreenGui

local HouseFireEvent = game:GetService("ReplicatedStorage"):WaitForChild(game.CodeValue.Value.."HouseFireEvent")

HouseFireEvent.OnServerEvent:connect(function()
      game.Players.LocalPlayer.PlayerGui["YourGUIName"].TextLabel.Text
end)

As I was typing this answer I realised you were trying to edit a GUI that’s located in StarterGui. When a new player joins, everything in the StarterGui gets replicated to the player’s PlayerGui. Instead of changing the GUI in StarterGui change it in all of the players PlayerGui.

I hoped I helped you fix your problem. If you encounter any further issues don’t hesitate to put a comment below.

2 comments

0

Could you make a Non-FE version instead with the script I have as I want to see what I did wrong with my script?

0

The thing that u did wrong with ur script is you changed game.StarterGui.ScreenGui, instead u should be changing the GUI in the Player. On a local script the gui path would be game.Players.LocalPlayer.PlayerGui.ScreenGui

This discussion is preserved as it was. New answers, comments, and votes are closed.