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

How do I Fire a Remote Event through text label? change the text of textlabel with a server script.

TimeValue = Instance.new("NumberValue")

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

while true do

     TimeValue.Value = 6

     TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]"

     wait(30)

     TimeValue.Value = 7

TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "AM" .. "[Day Shift]"

    wait(30)

     TimeValue.Value = 8

TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "AM" .. "[Day Shift]"

    wait(30)

     TimeValue.Value = 9
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "AM" .. "[Day Shift]"


       wait(30)

     TimeValue.Value = 10
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "AM" .. "[Day Shift]"

       wait(30)

     TimeValue.Value = 11
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "AM" .. "[Day Shift]"

       wait(30)

     TimeValue.Value = 12
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

    wait(30)

     TimeValue.Value = 1
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

		wait(30)

     TimeValue.Value = 2
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

     wait(30)

     TimeValue.Value = 3
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

      wait(30)

     TimeValue.Value = 4
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

		wait(30)

     TimeValue.Value = 5
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

     wait(30)

     TimeValue.Value = 6
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

       wait(30)

     TimeValue.Value = 7
     TextLabel.Text = "Time:" .. TimeValue.Value..":00".. "PM" .. "[Day Shift]"

end

1 answer

Simple look into how you would go about doing this.

Server Script

game.ReplicatedStorage.RemoteEvent:FireClient(player,'I love hamburger')

Local Script

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(text)
	script.Parent.TextLable.Text = text
end)

Here is a deep dive into the topic of remote events/functions

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

Edit: Reply to your comment :)

when doing GUI clocks the counter is housed on the server and the display is on the client...if that makes since

so on the server you would run the clock function and fire a remote function for every second

for x = 60,0,-1 do
	for i,v in pairs(game.Players:GetPlayers())do
		game.ReplicatedStorage.RemoteFunction:FireClient(x)
		wait(1)
	end
end

on the client you would update the display

game.ReplicatedStorage.RemoteFunction.OnClientEvent:Connect(function(x)
	script.Parent.TextLabel.Text = x
end

This would allow the clock to be synced across all client, the only delay would be client load times(this would not effect any other client)

7 comments

0

thx

0

But i need multiple texts that change within a delay of time, so can you help me with that? I want everyone to see the time as the same thing at not localy please help!

0

ill edit that into my answer :)

0

did you?

0

just did

0

but i need the text to change in a delay not the time of the sun

0

not sure what that means lol

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