repost

i made a simple handto script that will get the current tool the player is holding and give it to the player that they put in a gui, it doesnt give the other player the tool and the script gives 2 points instead of one.

--Local script

local player = game.Players.LocalPlayer
local playerName = script.Parent.Parent.PlayerName
local event = game.ReplicatedStorage:WaitForChild('HandToEvent')

script.Parent.MouseButton1Click:Connect(function()
	print('Button Pressed!')
	if game.Players:FindFirstChild(playerName.Text) then
		if  playerName.Text == player.Name then return end
			event:FireServer(playerName)
			print('Event fired!')
		end
end)
--Server

local event = game.ReplicatedStorage:WaitForChild('HandToEvent')

local function handTo(player, playerName) 
	local points = player.leaderstats.Points
	points.Value = points.Value + 1 
	print('Added points!')
	
	local tool
	
	for _, toool in pairs(player.Character:GetChildren()) do
		if toool:IsA('Tool') then
			tool = toool
		end
		
		tool.Parent = game.Players[playerName].Backpack
		print('Assigned tools parent to player!')
	end
end

event.OnServerEvent:Connect(handTo)

tysm if you can help!

1 comment

0

Are you sure that it is giving you two points??