Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Coding script to remove specific parts; script line is not doing anything, not getting error either?

This is the line of code that doesnt work:

if e[i].creator.Value == player then
    print("Works")
end

I'm not recieving an error so I'm really not sure what's going wrong, I've tried changing 'player' to 'player.Name' but that didn't work either.

Here is the rest of the code for context:

player = game.Players.LocalPlayer
PathTool = script.Parent
mouse = player:GetMouse()

function Clean()
	print(player)
	e = game.Workspace:GetChildren()
	for i = 1, #e do
		if e[i].className == "Part" then
			if e[i].Name == "PathPlatform" then
				if e[i]:findFirstChild("creator") ~= nil then
					if e[i].creator.Value == player then
						print("Works")
					end
				end
			end
		end
	end
end

mouse.KeyDown:connect(function(key)
	if key:byte() == 114 then
		Clean()
	end
end)

Any help would be greatly appreciated, I've tested the script and every line works except for 'if e[i].creator.Value == player then' - no error message in my Output either!

(Also I should add that the value of the Part.creator.Value is equal to the player's name)

1 answer

if e[i].creator.Value == player.Name then 	                        
	print("Works")                     
end

This discussion is preserved as it was. New answers, comments, and votes are closed.