I've made this script and I want it to clone an item into the player's inventory if they don't have it already, and I don't know all of the problems but I don't think I got to the player right
local getPlayerFromCharacter
script.Parent.MouseButton1Down:Connect(function(hit)
script.Parent.BackgroundTransparency = 0.9
local player = getPlayerFromCharacter(hit.Parent)
local arizona = game.ReplicatedStorage:WaitForChild("??????? ???")
if player.Backpack:FindFirstChild("??????? ???") then
print("already has")
script.Parent.BackgroundTransparency = 0
script.Parent.TextBox.Visible = true
wait(1)
script.Parent.TextBox.Visible = false
elseif not player.Backpack:FindFirstChild("??????? ???") then
local clone = arizona:Clone()
clone.Parent = player.Backpack
script.Parent.BackgroundTransparency = 0
end
end)

2 comments
you cant use hit because thats only for the touched event. you can put the part that detects the player in a local script and use remotes to connect the rest of the script.
so i can only use remote events to access the player from the script? :(