I’m making a skill points shop GUI (You can essentially buy skills using skill points earned by levelling up, which can then be used to upgrade stats like general damage, speed, etc. etc.), which displays the amount of skill points the player has already put into the specific skill they have selected.
Where the script buggers up, is when the amount of skill points gets returned to the local script, where it prints (as an error) into the output:
ServerScriptService.Skills.Skills:12: invalid argument #2 (string expected, got nil)
Here’s the scripts:
local script
local RS = game:GetService("ReplicatedStorage")
local Info = script.Parent.Parent.Parent.Parent:WaitForChild("Info")
local SelectedItem = script.Parent.Parent.Parent.Parent:WaitForChild("SelectedItem")
local ItemImage = Info.ItemImage
local ItemCount = Info.SkillPoints
local ItemName = Info.ItemName
local ItemOwned = Info.Owned
local ItemEquipped = Info.Equipped
local BuyButton = Info.Buy
script.Parent.MouseButton1Click:Connect(function(player, Name)
SelectedItem.Value = script.Parent.Name
local Count = RS.Skills.GetCount:InvokeServer(player, script.Parent.Name) -- ServerScriptService.Skills.Skills:12: invalid argument #2 (string expected, got nil)
ItemCount.Text = Count
ItemOwned.Value = Count
end)
and the server script
-- ***SKILLPOINTS LEADERSTAT INSIDE OF LEADERSTATS SCRIPT***
local replicatedStorage = game:GetService("ReplicatedStorage")
local Name = script.Name
local RSbin = replicatedStorage:WaitForChild(Name)
-- COUNT
RSbin.GetCount.OnServerInvoke = function(player,skill)
return player.Skills[skill].Value -- Relays back
end
What I would like to know is how I could fix the script so that the number gets logged.