Why is the ParticleEmitter giver not working in a gui button? When a player is level 5 they unlock this and can get it in their body. Error line 8 attempt to index local 'gvme' (a number value) What is wrong about it?

wait(2)
local Player = script.Parent.Parent.Parent.Parent.Parent
money = Player.leaderstats.Level
need = 5

function buy(gvme)
if money.Value >= need then
local human = gvme.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
script.Parent.ParticleEmitter:clone().Parent = human.Parent:findFirstChild("Torso")
end
end
end
script.Parent.MouseButton1Down:connect(buy)

while true do
	wait(2)
if money.Value >= 5 then
	script.Parent.Text = "Unlocked"
else
	if money.Value <= 5 then
		script.Parent.Text = "Locked"	
	end
end
end

2 comments

0

It's either 1 of 2 things. 1) You haven't declared "gvme". And 2) You can't "retrieve" a player's character through a Button, you can only get their Player.

0

It is possible, but still thanks I just found out how, forgot to look at wiki ;p