20:29:10.140 Players.BobygoWasTaken.PlayerGui.Main.Script.Script:7: attempt to index nil with 'FindFirstChild'
Part of the script that has the error:
local button = script.Parent
local playername = script.Parent.Parent.Parent.Parent.Name
local player = game.Workspace:WaitForChild(playername)
button.MouseButton1Click:Connect(function(player)
local character = player
local Data = character:FindFirstChild("Data")
local Values = Data:FindFirstChild("Values")
local canWalk = Values:FindFirstChild("canWalk")
local canJump = Values:FindFirstChild("canJump")
local humanoid = character:FindFirstChild("Humanoid")
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local button = script.Parent
button.MouseButton1Click:Connect(function(player)
local Data = character:FindFirstChild("Data")
local Values = Data:FindFirstChild("Values")
local canWalk = Values:FindFirstChild("canWalk")
local canJump = Values:FindFirstChild("canJump")
local humanoid = character:FindFirstChild("Humanoid")
end)
Try changing local character = player.Character to local character = player.Character or player.CharacterAdded:Wait() If player.Character turns out to be nil, then it will go to player.CharacterAdded:Wait() where it will wait for the character to be added.