Simple script, no work, brain fart, please help me

I’m making a simple script for a dev GUI that just gives a player a value based on their userID. It gives me an error saying "UserID is not a valid member of Player “Players.bellyfan1090”, my name is there since I pasted my userID as a test. What’s the issue here? I’m having a brain fart rn

script.Parent.MouseButton1Down:Connect(function()
	local frame = script.Parent.Parent
	local id = frame.UserID.Text
	local amount = frame.Amount.Text
	print("bruh")
	for index, player in pairs (game.Players:GetPlayers()) do
		if player.UserID == id then
			print("check")
			for index, leaderstats in pairs (player:GetChildren()) do
				if leaderstats.Name == "leaderstats" then
					print("check")
					local playertime = leaderstats:FindFirstChild("Time")
					playertime.Value = playertime.Value + amount
				end
			end
		end
	end
end)
1 Like

Why are the UserID and the Amount childrens of the frame?

image
They shouldn’t be though.

Oh, I misread. They’re textboxes, thats why.

player.UserId

Also, if you’re running in a LocalScript, you can do the following:

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local leaderstats = Player:WaitForChild("leaderstats")
print(leaderstats.Time.Value)

Oh. My. God. It was all just because of ONE TYPO. Scripting moment istg

Okay, thanks for showing that to me.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.