I'm making a game based off the movie In Time. Each player has a clock on their arm that ticks to their death. I have a local script inside a SurfaceGUI that displays said clock on my character's arm.
The problem with the local script is I cannot see other players' clocks when I test the script on a local server. The text shows Label on them instead of the clock I've scripted.
I've worked with Remote Events on Client/Server communication, but I just cannot seem to figure out how to script in a way that allows players to see each other's clocks, knowing every player's clock is client-sided and not server-sided.
Is there a way for players to see each other's SurfaceGUI that's parented onto their characters, or is this idea way over my head?
Server-Sided Gui Cloning Script (that parents said gui to humanoid's left upper arm) inside ServerScriptService
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local GuiClone = script.OverheadGui:Clone()
wait(.1)
GuiClone.Parent = Character.LeftUpperArm
end)
end)
Parented to SurfaceGui: Clock Display Local Script
local store = game:GetService("ReplicatedStorage")
local Time = game.ReplicatedStorage.Time
wait()
function clock()
local seconds = game.Workspace.Seconds.Value
local miliseconds = math.floor(seconds/1000)
local minutes = math.floor(seconds/60)
local hours = math.floor(minutes/60)
local days = math.floor(hours/24)
local weeks = math.floor(days/7)
local years = math.floor(weeks/52)
seconds = seconds-minutes*60
minutes = minutes-hours*60
hours = hours-days*24
days = days-weeks*7
weeks = weeks-years*52
seconds=tostring(string.format("i•i•i•i•i•i",years,weeks,days,hours,minutes,seconds))
script.Parent.Clock.Text=seconds
end
while true do
wait()
clock()
end
Parented to SurfaceGui: Clock Ticking Local Script
wait(6)
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
repeat wait(1) until game.Workspace.Age.Value>=25
humanoid.Health=humanoid.Health-20
script["Time Out"]:Play()
while true do
if game.Workspace.Age.Value>=25 then
wait(1)
game.Workspace.Seconds.Value=game.Workspace.Seconds.Value-1
script.Parent.Clock.Ticking:Play()
local player = game.Players.LocalPlayer
else
wait()
end
if game.Workspace.Seconds.Value<=0 or humanoid.Health==0 then
game.Workspace.Seconds.Value=0
wait(.1)
humanoid.Health=0
script["Time Out"]:Play()
wait(3)
while true do
wait(.1)
script.Parent.Clock.TextColor3=Color3.fromRGB(0,0,0)
wait(3)
end
else
wait()
end
end
