I have a tool that when you click on a player it changes a string value to the players name and then it pulls up a Gui with a button that says arrest and when you click it, its supposed to fire this script. But it keeps saying its nil.
Outputs:
09:37:02.892 - Players.Player2.PlayerGui.ScreenGui.Frame.Attempted.LocalScript:10: attempt to index global 'Arrested' (a nil value)
09:37:02.893 - Stack Begin
09:37:02.894 - Script 'Players.Player2.PlayerGui.ScreenGui.Frame.Attempted.LocalScript', Line 10
09:37:02.895 - Stack End
Tool script:
local tool = script.Parent
local Mouse = game.Players.LocalPlayer:GetMouse()
tool.Activated:connect(function()
local Gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame
local Target = Mouse.Target
print("1")
local person = game.Players:GetPlayerFromCharacter(Target.Parent)
if Target == nil then return end --1
if Target ~= nil then--1
if person == nil then return end--1
if person ~= nil then--1
print(person.Name)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.PlayerName.Value = person.Name
Gui.Visible = true
end
end
end)
Attempt script:
Button = script.Parent
Player = game.Players.LocalPlayer
wait(3)
Name = Player.PlayerGui.ScreenGui.Frame.PlayerName
Arrested = game.Players:FindFirstChild(Name.Value)
Button.MouseButton1Down:connect(function()
Arrested.Team = "Jail"
Arrested:LoadCharacter()
end)

5 comments
Could you show the local script inside of Attempted to see what it is making nil?
Could you show us the right script? It would really help.
Yes, sorry. I thought I put it in there. It is now on there.
Im still not sure how to fix it though...
With how you have it set up you might as well just have "Arrested = Player.Name" because that is basically what you are doing in a long odd way.