I recently made this script, it's basically a core for changing stats from local scripts. The game is Filtering Enabled. When invoked, it'll send over the value it wants to change and what the value is. But whenever valuename is "Health", "Strength", "Speed", "Kagune", "Quinque" it says it's a nil value, the error occured at line 10 i think. Even though there is a value in playerdata. It only seems to work when the valuename is "Playing"
local replicatedstorage = game.ReplicatedStorage
local remoteinstance = replicatedstorage:WaitForChild("RemoteInstance")
local gamedata = replicatedstorage:WaitForChild("GameData")
local remote = remoteinstance:WaitForChild("ChangeStat")
--Variables
function remote.OnServerInvoke(player, valuename, value)
local playerdata = player:WaitForChild("BaseValue")
if valuename == "Health" or "Strength" or "Speed" or "Kagune" or "Quinque" then
if playerdata:FindFirstChild("SkillPoint").Value > 0 then
if gamedata:WaitForChild(valuename).Value > playerdata:WaitForChild(valuename).Value then
playerdata:FindFirstChild("SkillPoint").Value = playerdata:FindFirstChild("SkillPoint").Value - 1
playerdata:FindFirstChild(valuename).Value = playerdata:FindFirstChild(valuename).Value + 1
else
print("Max Stats!")
end
end
end
if valuename == "Playing" then
playerdata:WaitForChild(valuename).Value = value
else
playerdata:WaitForChild(valuename).Value = value
end
end

3 comments
Nevermind the error occured at Line 12.
It also seems like it does subtract one SkillPoint
where is the link that calls for ur function?