I need help defining character

The character isn’t loaded in when your script tries to index it.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() -- wait for the character to be added if it doesnt already exist

local Button = script.Parent.TextButton

while wait() do
    -- rest of your code
end

3 Likes

I already answered your question in your previous post.

2 Likes

See relevant article:

https://developer.roblox.com/en-us/api-reference/property/Player/Character

Sorry I didn’t see it, I got flagged.

Ok so I tried this its still coming up as an error

Code:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait() – wait for the character to be added if it doesnt already exist

local Button = script.Parent.TextButton

while wait()do
if Character.Jobs.elpablo.Value == true and Character.Jobs.elpablo.Ontheclock.Value == true then
wait(2)
script.Parent:TweenPosition(UDim2.new(0.931,0,0,0.896))
Button.MouseButton1Down:connect(function()
Player.leaderstats.Wallet.Value = Player.leaderstats.Wallet.Value + 100
script.Parent:TweenPosition(UDim2.new(2,0,0,0.896))
end)
end
end

I just realized you were using a serverscript and not a localscript. You can’t access LocalPlayer from the server.