In the output I am getting such errors as:
Players.Player1.PlayerGui.ScreenGui.framePage2.frameSkills.:40: attempt to call field 'Value' (a number value)
&
Players.Player1.PlayerGui.ScreenGui.framePage2.frameLabel.S:2: attempt to call field 'Value' (a number value)
I am just editing values in my script, but these error always appear.
Data = script.Parent.Parent.Parent.PlayerData
script.Parent.skillAccuracy.TextButton.MouseButton1Down:connect(function()
if script.Parent.valuePoints.Value ~= 0 then
Data.SkillData.dataAccuracy.Value = Data.SkillData.dataAccuracy.Value +1
script.Parent.valuePoints.Value = script.Parent.valuePoints.Value -1
end
end)
script.Parent.skillDefense.TextButton.MouseButton1Down:connect(function()
if script.Parent.valuePoints.Value ~= 0 then
Data.SkillData.dataDefense.Value = Data.SkillData.dataDefense.Value +1
script.Parent.valuePoints.Value = script.Parent.valuePoints.Value -1
end
end)
script.Parent.skillMagic.TextButton.MouseButton1Down:connect(function()
if script.Parent.valuePoints.Value ~= 0 then
Data.SkillData.dataMagic.Value = Data.SkillData.dataMagic.Value +1
script.Parent.valuePoints.Value = script.Parent.valuePoints.Value -1
end
end)
script.Parent.skillSpeed.TextButton.MouseButton1Down:connect(function()
if script.Parent.valuePoints.Value ~= 0 then
Data.SkillData.dataSpeed.Value = Data.SkillData.dataSpeed.Value +1
script.Parent.valuePoints.Value = script.Parent.valuePoints.Value -1
end
end)
script.Parent.skillStrength.TextButton.MouseButton1Down:connect(function()
if script.Parent.valuePoints.Value ~= 0 then
Data.SkillData.dataStrength.Value = Data.SkillData.dataStrength.Value +1
script.Parent.valuePoints.Value = script.Parent.valuePoints.Value -1
end
end)
while true do
script.Parent.skillAccuracy.TextLabel.Text = "Accuracy: " .. Data.SkillData.dataAccuracy.Value ""
script.Parent.skillDefense.TextLabel.Text = "Defense: " .. Data.SkillData.dataDefense.Value ""
script.Parent.skillMagic.TextLabel.Text = "Magic: " .. Data.SkillData.dataMagic.Value ""
script.Parent.skillSpeed.TextLabel.Text = "Speed: " .. Data.SkillData.dataSpeed.Value ""
script.Parent.skillStrength.TextLabel.Text = "Strength: " .. Data.SkillData.dataStrngth.Value ""
wait()
end
If someone were to analyse this code and find out what I am doing wrong, I would love it! Just a note to self, I will never use values like this again

1 comment
I originally had variables, but I was having a slight problem with the PlayerGui earlier.