Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

I think that game is only an object. You can only call functions. Use the GetService method. game:GetService("RunService")

0

It fixed the problem, thank you!

1 answer

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")

This discussion is preserved as it was. New answers, comments, and votes are closed.