In my game i have a giver button, on touch, and whoever the first player was to touch it, thats who it works for, when someone else tries to touch it after, it doesn't work. This is the script i used for it.
local passId = 389372006
local GPS = game:GetService("GamePassService")
local lighting = game.Lighting
local m249 = {lighting.M249, lighting.GM249}
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
local player = game.Players[part.Parent.Name]
if GPS:PlayerHasPass(player, passId) then
if player.Backpack:FindFirstChild(m249[2].Name)==nil or player.StarterGear:FindFirstChild(m249[2].Name)==nil then
m249[2]:Clone().Parent = player.Backpack
m249[2]:Clone().Parent = player.StarterGear
else
if player.Backpack:FindFirstChild(m249[1].Name)==nil and player.StarterGear:FindFirstChild(m249[1].Name)==nil then
m249[1]:Clone().Parent = player.Backpack
m249[1]:Clone().Parent = player.StarterGear
end
end
end
end
end)
The problem seems to be the "FindFirstChild" line, but i don't know how to fix that. Help?

2 comments
Can you add some whitespace please.
Whitespace?