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

How you give a player a tool that's been Clicked Like in Prison life?

I just tried this script and i don't know why it didn't work can you help me out?

    local player = game.Players.LocalPlayer

local clone = game.Workspace.Handgun:Clone()

local mouse = script.Parent.MouseClick:Connect(function(mouse)

if mouse then

clone.Parent = player.Backpack

end

end)

How do you give players a tool when the mouse get clicked like in Prison Life! Thank you for reading this!

2 comments

0

it isn't working because u use 'mouse' which is gonna make you receive if u click ur mouse only, use clickdetector instead and descend it into a BrickPart and redo your script.

0

the script parent is the ClickDetector @NickAtNick

2 answers

✓ Accepted answer
local Clickdect = --the location of your click detector
local klone = game.Workspace.Hangun.clone()
Clickdect.MouseClick:Connect(function()
    klone.Parent = game.Player.LocalPlayer.Backpack
end)

1 comment

0

You are trying to put an event into an if statement and thats why It's not working. If this doesn't work, tell me and I will try to help you.

you can not use localscripts inside of a click detector it must be a serverscript

script.Parent.MouseClick:Connect(function(player)
    print(player.Name)
end)

1 comment

0

everything else you wrote should work

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