i cant seem to make this work, i have been trying to make it so if you press 1, 2, or 3(if it exists) to print the skill name but it wont work :
–PathChoosing (Client)
local PathRemote = game.ReplicatedStorage.Remotes:WaitForChild("PathRemote")
local pathModule = require(game.ReplicatedStorage.PathChoice.PathModule)
local skillFunction = game.ReplicatedStorage.Remotes:WaitForChild("SkillUsage")
PathRemote.OnClientEvent:Connect(function(pathData)
if pathData and pathData.Path then
print("Received Path Data:", pathData.Path)
end
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local pathFrame = playerGui:WaitForChild("PathSkillChoice"):WaitForChild("PathFrame")
for _, path in pairs(pathModule) do
print("Path:", path.Path)
for i, skill in ipairs(path.PathSkills) do
local cloneTemp = script.SkillName:Clone()
cloneTemp.Name = skill.Name
cloneTemp.Text = skill.Name
cloneTemp.Parent = pathFrame
cloneTemp.Position = UDim2.new(0, 0, 0, i * 21)
end
end
end)
local function skillUsage(skillIndex)
for _, path in pairs(pathModule) do
print("Checking path:", path.Path)
if path.PathSkills then
print("PathSkills Count:", #path.PathSkills)
for i, skill in ipairs(path.PathSkills) do
print("Index:", i, "Skill Name:", skill.Name)
end
local skill = path.PathSkills[skillIndex]
if skill then
print("Using Skill:", skill.Name)
skillFunction:InvokeServer(skill.Name)
return skill.Name
end
end
end
print("No skill found for index:", skillIndex)
return nil
end
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(i, g)
if not g then
local keyMap = {
[Enum.KeyCode.One] = 1,
[Enum.KeyCode.Two] = 2,
[Enum.KeyCode.Three] = 3
}
local skillIndex = keyMap[i.KeyCode]
if skillIndex then
local skillName = skillUsage(skillIndex)
if skillName then
print("Successfully used skill:", skillName)
else
print("Skill usage failed at index:", skillIndex)
end
end
end
end)
–PathChoosing (Server)
local moduleScript = require(game.ReplicatedStorage.PathChoice.PathModule)
local players = game.Players
local function Path(plr, path)
local pathData = nil
for i, v in ipairs(moduleScript) do
if v.Path == path then
pathData = v
break
end
end
if pathData then
print(plr.Name .. " selected path: " .. pathData.Path)
end
end
local function SelectedPath(plr, selectedPath)
local pathData = nil
for i, v in ipairs(moduleScript) do
if v.Path == selectedPath then
pathData = v
print("Selected Path: " .. v.Path)
break
end
end
if pathData then
local pathSkills = pathData.PathSkills
for _, skill in ipairs(pathSkills) do
print(
"Selected Path skill: " .. skill[1]
)
end
end
end
players.PlayerAdded:Connect(function(plr)
SelectedPath(plr, "Angel")
end)
–Module
return {
{
Path = "Ruin",
PathSkills = {
{
"Darkness",
Cooldown = 3,
Duration = 2
},
{
"My will",
Cooldown = 3,
Duration = 2
}
}
},
{
Path = "Angel",
PathSkills = {
{
"Divinity Healing",
Cooldown = 4,
Duration = 3
},
{
"Enemy Duration", --[[ Selectable skill. ]]--
Cooldown = 4,
Duration = 3
}
}
}
}