Why my item giver is not working

someone said Clickdetector is returning Player
But I dont have any ideas to do
help me please
image

local shoose = game.ServerStorage.Shoose
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player then
		if not hit.Parent:FindFirstChild("Shoose") then
			shoose:Clone().Parent = hit.Parent
		end
	end
end)

try

local shoose = game.ServerStorage.Shoose
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	if player then
		if not player:FindFirstChild("Shoose") then
			shoose:Clone().Parent = hit.Parent
		end
	end
end)

its returning the player not the character

1 Like

Damn, it has red line on “shoose:Clone().Parent = hit.Parent”
I changed hit to player, but its not working

to parent that thing to the character do

local shoose = game.ServerStorage.Shoose
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	if player then
		if not player.Character:FindFirstChild("Shoose") then
			shoose:Clone().Parent = player.Character
		end
	end
end)

maybe this helps

1 Like
local shoose = game.ServerStorage.Shoose
script.Parent.ClickDetector.MouseClick:Connect(function(plr) -- (player, not character)
	local char = plr.Character -- selecting player's character --
	if not char:FindFirstChild("Shoose") then
		shoose:Clone().Parent = char -- placing tool in plr character --
	end
end)
1 Like
local shoose = game.ServerStorage.Shoose
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	if player then
        local char = player.Character or player.CharacterAdded:Wait()
		if not char:FindFirstChild("Shoose") then
			shoose:Clone().Parent = char
		end
	end
end)
1 Like

why the backpack?


1 Like

The Backpack is a container that holds the player’s inventory. It’s used for storing tools.

1 Like

but the thing he’s putting into the character is an accessory…

1 Like

Whoops, I thought they wanted to clone a tool. Apologies.

2 Likes

try this

local shoose = game.ServerStorage:WaitForChild("Shoose")
script.Parent.ClickDetector.MouseClick:Connect(function(hit)
	for _,v in pairs(game.Workspace:GetChildren()) do
		if v.Name == hit.Name then
			if not v:FindFirstChild("Shoose") then
				shoose:Clone().Parent = v
			end
		end
	end
end)
1 Like

Ty for everyone, finally its working :smiley:

1 Like