Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make my handto gui give 1 point instead of 2?

Asked by 3 years ago

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!

0
Are you sure that it is giving you two points?? cocajola3 6 — 3y

Answer this question