Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What am I doing wrong with this stat changing remote im trying to call?

game.ReplicatedStorage.RemoteEvents.ChangeStatRemote.OnServerEvent:Connect(function(plr, stat, val)
	if plr.Name == "my username" then
		plr.Stats[stat] = val
	else
		plr:Kick("No u")
	end
end)
-- ^ server script


game.ReplicatedStorage.RemoteEvents.ChangeStatRemote:FireServer('Level',500)
-- ^ local script

Level is not a valid member of Folder
-- ^ Error

1 answer

game.ReplicatedStorage.RemoteEvents.ChangeStatRemote.OnServerEvent:Connect(function(plr, stat, val)
    if plr.Name == "Elixcore" then -- Added your username
        plr.Stats[stat].Value = val -- Added .Value
    else
        plr:Kick("No u")
    end
end)
-- ^ server script


game.ReplicatedStorage.RemoteEvents.ChangeStatRemote:FireServer('Level',500)
-- ^ local script

Level is not a valid member of Folder -- Maybe the level value does not exist or is lowercase?
-- ^ Error

2 comments

0

the [stat].Value fixed everything!

0

I am happy I helped you! :D

This discussion is preserved as it was. New answers, comments, and votes are closed.