I am trying to make a block that when it is hit by a specific tool, it dissapers and gives the player some XP. However, when I run my code I get an error saying "Argument 1 Missing Or Nil". My code is below.
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == 'Vacuum' then
local plr = hit.Parent.Parent.Name
script.Parent.CanCollide = false
script.Parent.Transparency = 1
local exp = 2
local player = game.Players:FindFirstChild(plr.Name)
local plrcurrentexp = player.leaderstats.JobXP.Value
plrcurrentexp.Value = plrcurrentexp + exp
wait(120)
script.Parent.CanCollide = true
script.Parent.Transparency = 0
end
end)
Please Help!