#my script dont work even if i have item in player

1 messages · Page 1 of 1 (latest)

compact portal
#

my script dont work even if i have item in player

#

⁨```
local rs = game.ReplicatedStorage
local glina = rs.items.glina:WaitForChild("Glina")
local player = game:GetService("Players")
local lp = player.LocalPlayer
while true do
for i,v in pairs(workspace:WaitForChild(lp.Name):GetChildren()) do
if v:FindFirstChild("Glina") then
print("founded")
end
end
task.wait(0.1)
end

grizzled tide
#

use localplayer.character instead of searching for the character in workspace

#

use a for loop to cycle through all children of the player and print their names after

#

that way you can get a better idea of what's wrong

compact portal
#

its printing so ig something with if statement

grizzled tide
#

mhm, if you

#

oops

#

if you're planning on finding it through name, set the name to string.lower() and compare it that way

#

it will ignore case sensitivity

compact portal
#

thanks it works

compact portal
#

@grizzled tide i changed name and its dont work anymore

grizzled tide
#

you're typing in the string.lower method and including the entry you're trying to find

#

i was suggesting that in the if statement you include: if string.lower(v.Name) == "stringimfinding" then

#

what your code is doing is turing "Clay" into "clay"

#

which is making it impossible to find anything in workspace named "Clay"

#

since it'd be case sensitive

#

the string.lower method here is redundant and you can remove it

#

it's the problem you're having- sorry if i made it a bit confusing

compact portal
#

its good you taught me new thing