So I have 2 scripts one that creates a part when the player joins and .1 the part moves to the players torso and its big enough that it engulfs the player ( the part is transparent)
THE ERROR IS IN SCRIPT 2 NOT 1
-- THERE IS NO ERROR IN THIS SCRIPT game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:wait() plr.Character:WaitForChild("Torso") local torso = plr.Character.Torso local part = Instance.new("Part", game.Workspace) part.Transparency = 1 part.CanCollide = false part.Size = Vector3.new(7,7,7) game.Lighting.Find:Clone().Parent = part part:FindFirstChild("Find").Disabled = false part.Anchored = true while wait(0.025) do part.CFrame = CFrame.new(torso.Position) end end) -- THERE IS NO ERROR IN THIS SCRIPT
and in that part a script is copied from the lighting to it I want that script that if the part touches anything to look for an object inside it called "ItemName" if that object exists then print the parents name
while wait(0.1) do script.Parent.Touched:connect(function(hit) local found = hit:FindFirstChild("ItemName") if found then print(found.Parent.Name) end end) end
I don't see any errors in my code for the second script but for some reason it just doesn't work
Remove the while wait(0.1) loop.
Make sure capitalization for ItemName is correct, and. That ItemName is a child of the colliding part, if another part from the same model impacts the brick it won't work.
There doesn't appear to be any other problems.