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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)

0
thx trickortreat333444 -6 — 5y
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! trickortreat333444 -6 — 5y
0
ill edit that into my answer :) ForeverBrown 356 — 5y
0
did you? trickortreat333444 -6 — 5y
View all comments (3 more)
0
just did ForeverBrown 356 — 5y
0
but i need the text to change in a delay not the time of the sun trickortreat333444 -6 — 5y
0
not sure what that means lol ForeverBrown 356 — 5y
Ad

Answer this question