Hey guys, here I am, again, with another question about my Admin Panel;
I created a RemoteEvent called "gold", which will reset the target's gold when a specific TextButton is pressed. This is the code I'm using, but the Output is responding with:
RegisteredCode is not a valid member of Players, even though, clearly, I am a member of Players.
Thanks to incapaz for most of this script
LOCALSCRIPT:
local target = script.Parent.Parent.user
local event = game.ReplicatedStorage.gold
function reset(user)
event:FireServer(user)
end
script.Parent.MouseButton1Click:Connect(function()
if game.Players:FindFirstChild(target.Text) then
if not game.Players[target.Text]:IsA("Player") then return end
reset(target.Text)
else
print("Nope!")
end
end)
SCRIPT:
game.Players.PlayerAdded:Connect(function(plr)
local int = Instance.new("IntValue")
int.Parent = plr
int.Name = "gold"
int.Value = 10
end)
local resetgold = game.ReplicatedStorage.gold
resetgold.OnServerEvent:Connect(function(player, user)
game.Players(user).gold.Value = 0
end)

2 comments
Thanks, didn't realize using [] was such a difference from ()! And where are the hiccups according to you? I honestly thought my tabbings were perfect
Lines 11-13 on the local script are tabbed once to the right. Line 10's if statement ends on the same line.