Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My text for my gui is not showing with FE enabled?

Asked by 5 years ago

im pretty new to scripting and im learning fe right now and im making a crappy game for practice

local script

local rs = game:GetService("ReplicatedStorage")
local event = rs.events.RemoteEvent
local bad = game.ReplicatedStorage.events:WaitForChild("RemoteEvent")
local sp = script.Parent
local int = sp:WaitForChild("IntValue")
local hum = game.Players.LocalPlayer.Character.Humanoid
local tex = game.StarterGui.ScreenGui:WaitForChild("TextLabel")

 function goo()
    tex.Text = "Faith in Humanity = "..int.Value
end

bad.OnClientEvent:Connect(goo)

script

game.Players.PlayerAdded:Connect(function(gof)
    game.ReplicatedStorage.events.RemoteEvent:FireClient()
end)

2 answers

Log in to vote
0
Answered by 5 years ago

This is because you didn't specify the client to fire to.

game:GetService("Players").PlayerAdded:Connect(function(gof)
    game:GetService("ReplicatedStorage").events.RemoteEvent:FireClient(gof)
end)

0
Line 2 got cot uff. It's FireClient(gof) User#19524 175 — 5y
0
still doesnt work :( poopstermaniac 1 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

As stated above by incapaz, you didn't fire the event to the specific client. Therefore you need to add the client in the parameters of :FireClient(), you used "gof" as your client so it should be:

game:GetService("Players").PlayerAdded:Connect(function(gof)
    game:GetService("ReplicatedStorage").events.RemoteEvent:FireClient(gof)
end)

Additionally in the local script on Line 7 you set the directory of the TextLabel to:

game.StarterGui.ScreenGui:WaitForChild("TextLabel")

StarterGui is cloned to the player when they respawn and is not the actual gui's that the player is seeing. You should instead use PlayerGui. It is located inside the player in game:GetService("Players"):

game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui:WaitForChild("TextLabel")

Everything should work after this.

0
Still doesnt work poopstermaniac 1 — 5y

Answer this question