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

My tool does not parent itself to Lighting. Any errors in my script?

wait(0.1)
if script.Parent.Parent.Parent.Name == not "RazorXX2" then
	script.Parent.Parent = game.Lighting
end
wait(0.1)
script:Destroy()

Help! The script is not working, the tool is showing up for everyone. So the concept here is that if the name of the player is not "RazorXX2" then the tool will move to Lighting, but it is not working. Is there any error here? Oh, by the way this is a local script parented to a tool in the player's backpack.

4 comments

0

IS it in a playerjoinedfunction?

0

why not using ~= so it only fires when its a false statement or if you bad then do == and put the code in else

0

and where is it located, and it's a very bad script since you need playeradded function, not waits

0

why did i not think of that lol

2 answers

i think you meant for:

game:GetService("Players").PlayerAdded:Connect(function(player) -- Get player by doing this
	if player.Name == "RazorXX2" then -- If player name is RazorXX2
		game:GetService("Lighting").Tool:Clone().Parent = game:GetService("StarterPack") -- Made this because player respawn, the tool still exists
		game:GetService("Lighting").Tool:Clone().Parent = player.Backpack
	end
end)

Instead of detecting it's not RazorXX2, why not thinking detect if it's RazorXX2 and do the complete opposite

also, put your tool in Lighting, and name the Tool to the tool, and bhlah blahla blah

4 comments

0

*gets tired of writing

0

sorry bro but my tool breaks when it clones

0

wait lemme try to fix this again

0

and also, playeradded does not work in local scripts

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