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

Not sure why I'm having this RemoteEvent Issue with displaying values on a GUI?

Asked by 5 years ago
Edited 5 years ago

I'm trying to retrieve values from a data store on the server storage and then make them readable with a GUI, the problem I'm having is that its displaying values of zero. However, when i checked the values on the server, they aren't equal to zero.

screenshot of the client: http://prntscr.com/m787wt
screenshot of the server: http://prntscr.com/m788ak

on the Sever Script

local Players = game:GetService("Players")
local dataremote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes").ReadData

local function onPlayerAdded(player)
    local datafolder = game.ServerStorage:WaitForChild(player.Name)
    local maxhealth = datafolder:WaitForChild("MaxHealth").Value
    local stamina = datafolder:WaitForChild("Stamina").Value
    local level = datafolder:WaitForChild("Level").Value
    dataremote:FireClient(player, maxhealth, stamina, level)
end

Players.PlayerAdded:Connect(onPlayerAdded)

on the Local Script

local plr = game.Players.LocalPlayer
repeat wait() until plr and plr.Character
local char = plr.Character
local dataremote = game:GetService("ReplicatedStorage"):WaitForChild("Remotes").ReadData

local function onGuiDataLoad(maxhealth, level, stamina)
    script.Parent.Frame.health.Text = maxhealth
    script.Parent.Frame.level.Text = level
    script.Parent.Frame.stamina.Text = stamina
end

dataremote.OnClientEvent:Connect(onGuiDataLoad)
0
a more sensible solution would be to put the int values where the client can access them, as that would negate this issue theking48989987 2147 — 5y

Answer this question