✓ Accepted answer
The first issue is you are parsing a function as a parameter when you call FireAllClients()
The second issue is you are trying to change the property Value in a TextLabel. You can see every property of a TextLabel here
When calling FireAllClients() you need to put inside the brackets () a list of arguments for the client to receive. This will be received by every client. Therefore, to do what you're trying to achieve it would look something like this:
Version1
local placeVersion = game.PlaceVersion
game.ReplicatedStorage.VersionEvent:FireAllClients(placeVersion)
Version 2
game.ReplicatedStorage.VersionEvent.OnClientEvent:Connect(function(placeVersion)
script.Parent.Text = placeVersion
print("Value Set.")
end)
See, the difference between Version1 and Version2 is that V1 is a procedure (function with no return value), whereas V2 is an event. That is why we connect the event to a function. It means "Once v2 is called, connect it to this function (run it)". And V1 saying :FireAllClients() simply calls the event.
Another thing to note is that you don't need to use all this networking just to get the game's version. It is accessible from the client too.
Here is an example taken from the wiki on how to do what you're trying to achieve.
local StarterGui = game:GetService("StarterGui")
local versionGui = Instance.new("ScreenGui")
local textLabel = Instance.new("TextLabel")
textLabel.Position = UDim2.new(1, -10, 1, 0)
textLabel.AnchorPoint = Vector2.new(1, 1)
textLabel.Size = UDim2.new(0, 150, 0, 40)
textLabel.BackgroundTransparency = 1
textLabel.TextColor3 = Color3.new(1, 1, 1)
textLabel.TextStrokeTransparency = 0
textLabel.TextXAlignment = Enum.TextXAlignment.Right
textLabel.TextScaled = true
local placeVersion = game.PlaceVersion
textLabel.Text = string.format("Server version: %s", placeVersion)
textLabel.Parent = versionGui
versionGui.Parent = StarterGui
Best of luck!
1 comment
Why are you putting a function in the FireAllClients?