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

Attempt to call a user data value ??? what does this mean

Asked by
Osamiku 12
4 years ago

I am making a script that updates a TextLabel through a string value once someone joins the game and on line 30 I am getting the error in output:

Players.Osamiku.PlayerGui.Client:30: attempt to call a userdata value

here is the code:

--Player--
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local gui = player:WaitForChild("PlayerGui")
local ui= gui:WaitForChild("ui")

--Assets--
local rep = game.ReplicatedStorage
local assets = rep.Assets

--Maps--
local maps = assets.Maps

--Signals--
local signals = assets.Signals
local event = signals.Event
local fevent = signals.FEvent

--Game Variables--
local Game = game.StarterGui.Game
local stats = Game.Stats

--Static Variables--
local vars = {
    currentVote=nil;
    services={};
}

--Initiate Title Updater
game("GetService", "RunService").RenderStepped:connect(function()
    ui:WaitForChild("Title").Text = game.StartGui.Game.Stats.Status.Value
end)


Line 30 btw

0
I think that `game` is only an object. You can only call functions. Use the GetService method. game:GetService("RunService") pidgey 548 — 4y
0
It fixed the problem, thank you! Osamiku 12 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Fixed your code.

--Player--
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local gui = player:WaitForChild("PlayerGui")
local ui= gui:WaitForChild("ui")

--Assets--
local rep = game.ReplicatedStorage
local assets = rep.Assets

--Maps--
local maps = assets.Maps

--Signals--
local signals = assets.Signals
local event = signals.Event
local fevent = signals.FEvent

--Game Variables--
local Game = game.StarterGui.Game
local stats = Game.Stats

--Static Variables--
local vars = {
    currentVote=nil;
    services={};
}

--Initiate Title Updater
game:GetService("RunService").RenderStepped:connect(function()
    ui:WaitForChild("Title").Text = game.StartGui.Game.Stats.Status.Value
end)

--there is no such syntax as game("GetService","RunService")
Ad

Answer this question