Hi I'm trying to make it so when "Experience" is changed it sends the value to the client of that changed exp. So in the client a text label might say "Experience: (value)" but when I do it, the client saids the value is nil even though it isn't.
-- OUTPUT ERRORS -- 16:27:39.791 - Unable to cast value to Object 16:27:39.792 - Stack Begin 16:27:39.793 - Script 'ServerScriptService.Script', Line 10 16:27:39.793 - Stack End
-- Server
local d = {
level = 12,
exp = 15,
gold = 0
}
local createPopupRequest = game.ReplicatedStorage:WaitForChild("RemoteFunction")
local function onPlayerAdded(player)
wait(1)
createPopupRequest:InvokeClient(d.exp)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
-- Client
local createPopupRequest = game.ReplicatedStorage:WaitForChild("RemoteFunction")
local function onCreatePopupRequested(val) -- it doesn't return a player value a it doesn't need to.
script.Parent.TextLabel.Text = "Gold = " .. val
end
createPopupRequest.OnClientInvoke = onCreatePopupRequested

2 comments
mind you that the local function isn't commented on the actual script it is here for some reason
i had the same thing but why don't you just return that value