local sp = script.Parent
local db = true
local LocalP = game.Players.LocalPlayer
local Player = LocalP.Character
local Azarth = script.Parent.Option.Frame.ImageButtonFinalFlash
local Azarth2 = script.Parent.Option.Frame.ImageButtonFinalFlash2
local Azarth3 = script.Parent.Option.Frame.ImageButtonFinalFlash3
local Azarth4 = script.Parent.Option.Frame.ImageButtonFinalFlash4
local Bot = script.Parent.Parent.Parent.Suit
local Flash = Bot.Arm1.Middle:WaitForChild("FinalArmCharge")
local Flash2 = Bot.Chest.Middle:WaitForChild("FinalCharge")
sp.Touched:connect(function(hit)
if hit and hit.Parent:findFirstChild("Humanoid") and db then
db = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.PlayerGui:findFirstChild("Option") then
Azarth:Clone().Parent = player.PlayerGui:WaitForChild("Option"):WaitForChild("Frame")
Azarth2:Clone().Parent = player.PlayerGui:WaitForChild("Option"):WaitForChild("Frame")
Azarth3:Clone().Parent = player.PlayerGui:WaitForChild("Option"):WaitForChild("Frame")
Azarth4:Clone().Parent = player.PlayerGui:WaitForChild("Option"):WaitForChild("Frame")
Flash:Clone().Parent = Player.Arm1.Middle
Flash:Clone().Parent = Player.Arm2.Middle
Flash2:Clone().Parent = Player.Chest.Middle
end
wait()
db = true
end
end)
this is the whole script but then it tells me "attempt to index local 'LocalP' (a nil value)". any way to counter this?

13 comments
Is this a local script or a script?
regular script
it's a script, localplayer is not in scripts because it runs on the server so it doesn't know which player is you, but localscript is on the client.
i changed it to a localscript and still doesnt work but this time doesnt even tell me why it doesnt work
You realise this code is not meant to do anything this is all just variables
this is the first part of the script i didnt put the full thing in as it was the variables that i had a problem with
So can we have the full script? maybe that will help??
there u go
Torso, not Chest
chest is the name of another thing welded to the character & is inside the character model
change "LocalPlayer" to "SirTottenhamcake" OR put the script in "StarterPlayer" > "StarterPlayerScripts" and change "game.Players.LocalPlayer" into "script.Parent.Parent.Parent.Parent" (works or not works based on your Parenting System)
try debugging it. i am new to Lua, this thing is out of my reach.
script is meant to work by touching a part which clones a gui into the frame