Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How Can I Get The Weapon Through Click?

Asked by 1 year ago
Edited 1 year ago

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!

0
Are you getting any errors in your Output? Ziruken 139 — 1y
0
the tool is a tool and has a handle right AltNature 169 — 1y
0
Ill edt it AltNature 169 — 1y

1 answer

Log in to vote
0
Answered by
AltNature 169
1 year ago
Edited 1 year ago

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)
0
how would this work with a server script? Gameplayer365247v2 884 — 1y
Ad

Answer this question