You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
- Well, I want to make it when a player has a tool out and clicks U on another player the tool goes to that player.
-
What is the issue? Include screenshots / videos if possible!
It just doesnt give the tool at all, with no errors… -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried to look on the Dev Hub, nothing here helps.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
CLIENT
local P = game.Players.LocalPlayer
local M = P:GetMouse()
local tool = script.Parent
local Equipped = false
tool.Equipped:Connect(function()
Equipped = true
P.PlayerGui.Main.F.Visible = true
end)
tool.Unequipped:Connect(function()
Equipped = false
P.PlayerGui.Main.F.Visible = false
end)
script.Parent.Activated:Connect(function()
Equipped = false
P.PlayerGui.Main.F.Visible = false
end)
M.KeyDown:Connect(function(Key)
if string.lower(Key) == "u" and Equipped == true then
warn(M.Target,M.Target.Parent)
if M.Target ~= nil and M.Target:IsA("Part") and M.Target.Parent.Humanoid then
game.ReplicatedStorage.Fldr.Giving:FireServer(P,tool.Name,M.Target.Parent)
else
warn("no")
end
end
end)
SERVER
local HttpService = game:GetService("HttpService")
local webhookUrl = "" -- Replace with your Discord webhook URL
game.ReplicatedStorage.Fldr.Giving.OnServerEvent:Connect(function(player, tool, dude, target)
local magnitude = (player.Character.Torso.Position - target.Torso.Position).magnitude
warn("target")
if magnitude <= 8 then
warn("started")
if player.Character:FindFirstChild(dude) then
warn("gave")
player.Character.Humanoid:UnequipTools()
local targetto = game.Players:GetPlayerFromCharacter(target)
player.Backpack:FindFirstChild(dude):Clone().Parent = targetto.Backpack
player.Backpack:FindFirstChild(dude):Destroy()
-- Log the event to Discord
--[[local logData = {
username = "Roblox Game Logger",
embeds = {
{
title = "Tool Given",
description = string.format("%s gave a %s to %s", player.Name, tool.Name, targetto.Name),
fields = {
{ name = "Giver Profile", value = player:GetFullName(), inline = true },
{ name = "Receiver Profile", value = targetto:GetFullName(), inline = true },
{ name = "Tool", value = tool.Name, inline = true }
},
color = 16711680 -- Red color
}
}
}
local logDataJson = HttpService:JSONEncode(logData)
HttpService:PostAsync(webhookUrl, logDataJson, Enum.HttpContentType.ApplicationJson)]]
end
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.