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

Help with giving tools from click detector?

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

3 comments

0

Is it inside a LocalScript or a Script?

0

This is inside of a LocalScript.

0

if plr:IsInGroup(3983801) and ...?

1 answer

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

1 comment

0

LocalPlayer doesn't work in game in a ServerScript.

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