Needing help on a skill gaining system

Hello, I’m rip_Zephyr, I’m making a game where every time you swing your sword you get +5 “Skill Points” However, I need a way to access a certain player’s skill points because game.Players.Player.PlayerSkill or game.Players.UserId.PlayerSkill don’t work. If you’re confused, take a look at my code.

task.wait(1.5)

local Character
local Player

local ScriptsFolder = script.Parent
local Tool = ScriptsFolder.Parent
local AnimationsFolder = Tool:WaitForChild("Animations")

local epicSwingAnimation = AnimationsFolder:WaitForChild("epicSwordSwing")
local epicSwingTrack

local Cooldown = false
local CooldownWait = 0.75

local SkillPoints = game.Players.UserId.PlayerSkill

Tool.Equipped:Connect(function()
	Character = Tool.Parent
	Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
	
	local humanoid = Character:FindFirstChild("Humanoid")
	
	if humanoid then
		epicSwingTrack = humanoid:LoadAnimation(epicSwingAnimation)
	end
end)


Tool.Activated:Connect(function()
	if Cooldown == false then
		Cooldown = true
				
				SkillPoints.Value += 5
				epicSwingTrack:Play()
		
		wait(CooldownWait)
		Cooldown = false
	end
end)

get PlayerSkill when the tool is equipped

task.wait(1.5)

local Character
local Player

local ScriptsFolder = script.Parent
local Tool = ScriptsFolder.Parent
local AnimationsFolder = Tool:WaitForChild("Animations")

local epicSwingAnimation = AnimationsFolder:WaitForChild("epicSwordSwing")
local epicSwingTrack

local Cooldown = false
local CooldownWait = 0.75

local SkillPoints

Tool.Equipped:Connect(function()
	Character = Tool.Parent
	Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
	SkillPoints = Player.PlayerSkill

	local humanoid = Character:FindFirstChild("Humanoid")
	
	if humanoid then
		epicSwingTrack = humanoid:LoadAnimation(epicSwingAnimation)
	end
end)


Tool.Activated:Connect(function()
	if Cooldown == false then
		Cooldown = true
				
				SkillPoints.Value += 5
				epicSwingTrack:Play()
		
		wait(CooldownWait)
		Cooldown = false
	end
end)
1 Like

thank you so much this was a huge help to my game!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.