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

Why is the call on character not working? Works in studio.

Error: https://gyazo.com/a7ff2d4e964399d807b57e841779423b This script is in a tool that's inside a players backpack which is inside the player Here's the code.

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
--local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
local clickDetecter1 = Instance.new("ClickDetector")
local clickDetecter2 = Instance.new("ClickDetector")
local clickDetecter3 = Instance.new("ClickDetector")
local clickDetecter4 = Instance.new("ClickDetector")
local clickDetecter5 = Instance.new("ClickDetector")
print(script.Parent.Parent.Parent.Character.Humanoid)
local humanoid = script.Parent.Parent.Parent.Character.Humanoid
local var = 0
local d = humanoid.Parent:GetChildren() 
local e = game.ReplicatedStorage:GetChildren()
--local leftArm = script.Parent.Parent:FindFirstChild("Left Arm")
--local rightArm = script.Parent.Parent:FindFirstChild("Right Arm")
--local rightLeg = script.Parent.Parent:FindFirstChild("Right Leg")
--local leftLeg = script.Parent.Parent:FindFirstChild("Left Leg")



tool.Equipped:connect(function(mouse)
	
 	--wait(1)
	mouse.Button1Down:connect(function()
		local brickColor1 = game.ReplicatedStorage.colorsave:Clone()
		brickColor1.BrickColor = script.Parent.Parent.Torso.BrickColor
		local brickColor2 = game.ReplicatedStorage.colorsave:Clone()
		brickColor2.BrickColor = script.Parent.Parent:FindFirstChild("Right Leg").BrickColor
		local brickColor3 = game.ReplicatedStorage.colorsave:Clone()
		brickColor3.BrickColor = script.Parent.Parent:FindFirstChild("Right Arm").BrickColor
		local brickColor4 = game.ReplicatedStorage.colorsave:Clone()
		brickColor4.BrickColor = script.Parent.Parent:FindFirstChild("Left Leg").BrickColor
		local brickColor5 = game.ReplicatedStorage.colorsave:Clone()
		brickColor5.BrickColor = script.Parent.Parent:FindFirstChild("Left Arm").BrickColor
		local brickColor6 = game.ReplicatedStorage.colorsave:Clone()
		brickColor6.BrickColor = script.Parent.Parent.Head.BrickColor
		
		brickColor1.Parent = game.ReplicatedStorage
		brickColor1.Name = "torsoColor"
		brickColor2.Parent = game.ReplicatedStorage
		brickColor2.Name = "rightLegColor"
		brickColor3.Parent = game.ReplicatedStorage
		brickColor3.Name = "rightArmColor"
		brickColor4.Parent = game.ReplicatedStorage
		brickColor4.Name = "leftLegColor"
		brickColor5.Parent = game.ReplicatedStorage
		brickColor5.Name = "leftArmColor"
		brickColor6.Parent = game.ReplicatedStorage
		brickColor6.Name = "headColor"
		
		
			if var ==0 then
				script.Parent.Sound2:Play()
			script.Parent.Parent.Shirt.Parent = game.ReplicatedStorage
			script.Parent.Parent.Pants.Parent = game.ReplicatedStorage
			local busoparticles = game.ReplicatedStorage.busoParticles:Clone()
			busoparticles.Parent = script.Parent.Parent.Torso
			local busoparticles1 = game.ReplicatedStorage.busoParticles:Clone()
			busoparticles1.Parent = script.Parent.Parent:FindFirstChild("Left Leg")
			local busoparticles2 = game.ReplicatedStorage.busoParticles:Clone()
			busoparticles2.Parent = script.Parent.Parent.Head
			local busoparticles3 = game.ReplicatedStorage.busoParticles:Clone()
			busoparticles3.Parent = script.Parent.Parent:FindFirstChild("Left Arm")
			local busoparticles4 = game.ReplicatedStorage.busoParticles:Clone()
			busoparticles4.Parent = script.Parent.Parent:FindFirstChild("Right Arm")
			humanoid.MaxHealth = 400
			humanoid.Health = humanoid.Health*4
			
			
			script.Parent.Parent.Head.BrickColor = BrickColor.Black()
			script.Parent.Parent.Head.Reflectance = 0.4
			script.Parent.Parent.Torso.Reflectance = 0.4
			script.Parent.Parent.Torso.BrickColor = BrickColor.Black()
			script.Parent.Parent:FindFirstChild("Left Arm").BrickColor = BrickColor.Black()
			script.Parent.Parent:FindFirstChild("Left Arm").Reflectance = 0.4
			script.Parent.Parent:FindFirstChild("Right Arm").BrickColor = BrickColor.Black()
			script.Parent.Parent:FindFirstChild("Right Arm").Reflectance = 0.4
			script.Parent.Parent:FindFirstChild("Left Leg").BrickColor = BrickColor.Black()
			script.Parent.Parent:FindFirstChild("Left Leg").Reflectance = 0.4
			script.Parent.Parent:FindFirstChild("Right Leg").BrickColor = BrickColor.Black()
			script.Parent.Parent:FindFirstChild("Right Leg").Reflectance = 0.4
			script.Parent.Parent.Humanoid.WalkSpeed = 10
			
			
		   local d = humanoid.Parent:GetChildren() 
	
			
			
			var = 1
			
			else 
				script.Parent.Parent.Torso.BrickColor = game.ReplicatedStorage.torsoColor.BrickColor
				var = 0
				game.ReplicatedStorage.Shirt.Parent = script.Parent.Parent
				game.ReplicatedStorage.Pants.Parent = script.Parent.Parent
				humanoid.Health = humanoid.Health/4
				humanoid.MaxHealth = 100
			
				script.Parent.Parent.Head.BrickColor = game.ReplicatedStorage.headColor.BrickColor
			script.Parent.Parent.Head.Reflectance = 0
			script.Parent.Parent.Torso.Reflectance = 0
			script.Parent.Parent.Torso.BrickColor = game.ReplicatedStorage.torsoColor.BrickColor
			script.Parent.Parent:FindFirstChild("Left Arm").BrickColor = game.ReplicatedStorage.leftArmColor.BrickColor
			script.Parent.Parent:FindFirstChild("Left Arm").Reflectance = 0
			script.Parent.Parent:FindFirstChild("Right Arm").BrickColor = game.ReplicatedStorage.rightArmColor.BrickColor
			script.Parent.Parent:FindFirstChild("Right Arm").Reflectance = 0
			script.Parent.Parent:FindFirstChild("Left Leg").BrickColor = game.ReplicatedStorage.leftLegColor.BrickColor
			script.Parent.Parent:FindFirstChild("Left Leg").Reflectance = 0
			script.Parent.Parent:FindFirstChild("Right Leg").BrickColor = game.ReplicatedStorage.rightLegColor.BrickColor
			script.Parent.Parent:FindFirstChild("Right Leg").Reflectance = 0
			script.Parent.Parent.Humanoid.WalkSpeed = 16
			
			
			
			for i=1, #d do 
		
	end
			
			
			end
			--leftArm.BrickColor = BrickColor.Black()
			--leftArm.Reflectance = 0.4
			--rightArm.BrickColor = BrickColor.Black()
			--rightArm.Reflectance = 0.4
			--leftLeg.BrickColor = BrickColor.Black()
			--leftLeg.Reflectance = 0.4
			--rightLeg.BrickColor = BrickColor.Black()
			--rightLeg.Reflectance = 0.4
			
			
		end)
		
	end)


--script.Parent.Reload.Disabled = false
		--script.Disabled = true
		

1 answer

✓ Accepted answer

Calling the character doing

script.Parent.Parent.Parent.Character

is unwise a recommended way would simply be:

local player = game:GetService("Players").LocalPlayer
local char = player.Character
local human = char:WaitForChild('Humanoid')

maybe add a wait(.25) in the front iddkdkdkdk

hope this helped :/

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