I'm not sure why this doesn't work. I'm new to scripting.
local Players = game:GetService('Players') local function getPlayerByUserId(userId) script.Parent.Configuration.userId = userId end
Any help will be appreciated..
You aren't referencing to the specified Player you'd like to have replace your NumberValue
with their UserId
. You should do so. You haven't called the function either.
local Player = game:GetService('Players').LocalPlayer --// Returns *your* Player local function SetToPlayerId(UserId) --// I believe you understand arguments and parameter already? script.Parent.Configuration.userId = UserId end SetToPlayerId(Player.UserId)
This should work properly, this should be a LocalScript
inside of StarterPlayerScripts
.