Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How Can I Get The Weapon Through Click?

I was making a weapon that you can only get if you click it, not touch it

The ScrewDriver is the Main Mesh Inside the ScrewDriver (Mesh) There is a Script,ClickDetector,ScrewDriver The other screwdriver that is the child of the screwdriver is the mainweapon, a tool

local weapon = script.Parent
local Click = script.Parent.ClickDetector
local mainweapon = script.Parent.ScrewDriver
local player = game.Players.LocalPlayer
local playerlocation = game.Players:FindFirstChild(""..player.Name)

Click.MouseClick:Connect(function()
	mainweapon.Parent = playerlocation
end)

But nothin is working, How can i fix this? please help

i also tried

local weapon = script.Parent
local Click = script.Parent.ClickDetector
local mainweapon = script.Parent.ScrewDriver
local player = game.Players.LocalPlayer

Click.MouseClick:Connect(function()
	mainweapon.Parent = player.Name.Backpack
end)

Please Help, Advanced Thanks!

3 comments

0

Are you getting any errors in your Output?

0

the tool is a tool and has a handle right

0

Ill edt it

1 answer

access the players Backpack not name you dont need to because name is a string value of the localplayers name not the actual player

local weapon = script.Parent
local Click = script.Parent.ClickDetector
local mainweapon = script.Parent.ScrewDriver

 
Click.MouseClick:Connect(function(Player)
    mainweapon.Parent = Player.Backpack
end)

1 comment

0

how would this work with a server script?

This discussion is preserved as it was. New answers, comments, and votes are closed.