nothing changed. still wont work.
script.Parent.Triggered:Connect(function(plr)
local wood = game:GetService("Players"):FindFirstChild(plr).leaderstats.Wood
wood.Value = wood.Value + 1
print('succes + 1')
script.Parent.Parent:Destroy()
print('succes destroyed')
end)
print the player
as in
print(plr)
script.Parent.Triggered:Connect(function(plr)
local wood = game:GetService("Players"):FindFirstChild(plr).leaderstats.Wood
print("plr")
wood.Value = wood.Value + 1
print('succes + 1')
script.Parent.Parent:Destroy()
print('succes destroyed')
end)
like this?
it has to be as in print(plr) exactly like that
nothing printed when i clicked play
show another video also show the output stuff
robloxapp-20230415-1534558.wmv (2.0 MB)
Workspace.Tree4.TreeStem2.ProximityPrompt.Script:2: attempt to index nil with âleaderstatsâ
Script âWorkspace.Tree4.TreeStem2.ProximityPrompt.Scriptâ, Line 2
make the first line inside of the function print(plr) and see what it prints
Workspace.Tree4.TreeStem2.ProximityPrompt.Script:3: attempt to index nil with âleaderstatsâ
it prints plr 2 times. so it gets stuck at the + value line.
script.Parent.Triggered:Connect(function(plr)
print("plr")
local wood = game:GetService("Players"):FindFirstChild(plr).leaderstats.Wood
print("plr")
wood.Value = wood.Value + 1
print('succes + 1')
script.Parent.Parent:Destroy()
print('succes destroyed')
end)
you did it wrong dont put ââ it should print your name
i ment to not put ââ
iiiiiiiiiiiiiiii
yeah it printed my name but i get:
Workspace.Tree4.TreeStem2.ProximityPrompt.Script:3: attempt to index nil with âleaderstatsâ
try removing this game:GetService(âPlayersâ):FindFirstChild(plr) and replace it with plr if it doesnt work then put game:GetService(âPlayersâ):FindFirstChild(plr) back
script.Parent.Triggered:Connect(function(plr)
print(plr)
local wood = game.plr.leaderstats.Wood
print("plr")
wood.Value = wood.Value + 1
print('succes + 1')
script.Parent.Parent:Destroy()
print('succes destroyed')
end)
this?
remove game.
it works thank you so much for the help!