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

Help with giving tools from click detector?

Asked by 6 years ago

Hello. I made a cup part, when it is clicked it should give the player who clicked it a tool. That isn't happening though. The output gives no error either.

Here is the script:

game.Players.LocalPlayer:WaitForChild('Backpack')
function onClicked(plr)
    if plr:GetRankInGroup(3983801) >= 2 then
        local sc1 = game.ServerStorage.Tools.Cups.WhiteCups.SmallEmptyCup:Clone()
        sc1.Parent = game.Players.LocalPlayer.Backpack
        sc1.Name = ('Small Empty Cup')
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Help would be appreciated.

Thanks

0
Is it inside a LocalScript or a Script? LordMerc 25 — 6y
0
This is inside of a LocalScript. bluestreakejjp 41 — 6y
0
`if plr:IsInGroup(3983801) and ...`? TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Nevermind, I fixed it by changing it to a regular script. Thanks anyway.

0
LocalPlayer doesn't work in game in a ServerScript. theCJarmy7 1293 — 6y
Ad

Answer this question