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?
Hello,
You seem new to Rbx.Lua.
Things you can learn :
1.LocalPlayer can only be used in a LocalScript.
2.You can use PlayerAdded event to get the joining players.
3.
connect
is deprecated , it is better to useConnect
--//This Script must be inside of a part//-- local db = true local part = script.Parent local gui = game.ReplicatedStorage:FindFirstChild('Gui')--<< Place the gui you want on that path... script.Parent.Option.Frame.ImageButtonFinalFlash local Azarth = gui.Opition.Frame.ImageButtonFinalFlash local Azarth2 = gui.Option.Frame.ImageButtonFinalFlash2 local Azarth3 = gui.Option.Frame.ImageButtonFinalFlash3 local Azarth4 = gui.Option.Frame.ImageButtonFinalFlash4 local Bot = gui.Parent.Parent.Suit local Flash = Bot.Arm1.Middle:WaitForChild("FinalArmCharge") local Flash2 = Bot.Chest.Middle:WaitForChild("FinalCharge") part.Touched:Connect(function(hit) if hit.Parent:FindFirstChildOfClass("Humanoid") and db then -- You cannot hit 'nil' db = false local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player.PlayerGui:FindFirstChild("Option") then local g1 = gui:Clone() g1.Parent = player.PlayerGui Azarth:Clone().Parent = g1.Option.Frame Azarth2:Clone().Parent = g1.Option.Frame Azarth3:Clone().Parent = g1.Option.Frame Azarth4:Clone().Parent = g1.Option.Frame --[[Flash:Clone().Parent = Flash:Clone().Parent = player.Arm2.Middle Flash2:Clone().Parent = player.Chest.Middle ]]-- end end wait() db = true end)
That's all for the script. You need to adjust certain paths and such.
Thank you for reading!
Please upvote this post and accept it as an answer if it helped you.