Hands wont go back to visible

  1. What do you want to achieve? Keep it simple and clear!
    I want to make it so when the player scopes, it makes hands and tool invisible.
  2. What is the issue? Include screenshots / videos if possible!
    The hands are not becoming visible after I change them
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I couldn’t find anyone else with this problem
local player = game.Players.LocalPlayer
local tool = script.Parent
local gui = player.PlayerGui.ScreenGui.ImageLabel
local Animation = script.SniperScope -- insert animation id in the properties
local hum = script.Parent.Parent.Parent.Character.Humanoid -- The humanoid of the player
local Camera = workspace.CurrentCamera
local held = false
local animplayer = hum:LoadAnimation(Animation)
local UIS = game:GetService("UserInputService")
local held = false
local mouse = player:GetMouse()
animplayer.Looped = true
tool.Equipped:Connect(function()
	held = true
end)
tool.Unequipped:Connect(function()
	held = false
end)
local scoped = false
UIS.InputBegan:Connect(function(inp, proc)
	if proc then return end
	if inp.UserInputType == Enum.UserInputType.MouseButton2 then
		scoped = true
		if held then
			print("scoped")
		end
	end
end)
UIS.InputEnded:Connect(function(inp, proc)
	if proc then return end
	if inp.UserInputType == Enum.UserInputType.MouseButton2 then
		scoped = false
		if held then
		print("not scoped")
		end
	end
end)
while task.wait(0.1) do
	print("checked")
    if held == true then
		if scoped == true then
			tool.Handle.Transparency = 1
			player.Character:FindFirstChild("Left Arm").Transparency = 1
			player.Character:FindFirstChild("Right Arm").Transparency = 1
			animplayer:Play()
			gui.Visible = true
			Camera.FieldOfView = 35
			end
	end
	if held == false then
		tool.Handle.Transparency = 0
		player.Character:FindFirstChild("Left Arm").Transparency = 0
		player.Character:FindFirstChild("Right Arm").Transparency = 0
		animplayer:Stop()
		gui.Visible = false
		Camera.FieldOfView = 70
	end
	if scoped == false then
		tool.Handle.Transparency = 0
		player.Character:FindFirstChild("Left Arm").Transparency = 0
		player.Character:FindFirstChild("Right Arm").Transparency = 0
		animplayer:Stop()
		gui.Visible = false
		Camera.FieldOfView = 70
	end
end

I added a for loop instead of making each part transparent, it did not work

while task.wait(0.1) do
	print("checked")
    if held == true then
		if scoped == true then
			tool.Handle.Transparency = 1
			for i,v in player.Character:GetChildren() do
				if v.Name == "Right Arm" or v.Name == "Left Arm" then
					v.Transparency = 1
				end
			end
			animplayer:Play()
			gui.Visible = true
			Camera.FieldOfView = 35
			end
	end
	if held == false then
		tool.Handle.Transparency = 0
		for i,v in player.Character:GetChildren() do
			if v.Name == "Right Arm" or v.Name == "Left Arm" then
				v.Transparency = 0
			end
		end
		animplayer:Stop()
		gui.Visible = false
		Camera.FieldOfView = 70
	end
	if scoped == false then
		tool.Handle.Transparency = 0
		for i,v in player.Character:GetChildren() do
			if v.Name == "Right Arm" or v.Name == "Left Arm" then
				v.Transparency = 0
			end
		end
		animplayer:Stop()
		gui.Visible = false
		Camera.FieldOfView = 70
	end
end

Perhaps try this:

while task.wait(0.1) do
	print("checked")
    if held == true then
		if scoped == true then
			tool.Handle.Transparency = 1
			for _,v in pairs(player.Character:GetChildren()) do
				if v.Name == "Right Arm" or v.Name == "Left Arm" then
					player.Character:WaitForChild(v.Name).Transparency = 1
				end
			end
			animplayer:Play()
			gui.Visible = true
			Camera.FieldOfView = 35
		end
	end
	if held == false or scoped == false then
		tool.Handle.Transparency = 0
		for _,v in pairs(player.Character:GetChildren()) do
			if v.Name == "Right Arm" or v.Name == "Left Arm" then
				player.Character:WaitForChild(v.Name).Transparency = 0
			end
		end
		animplayer:Stop()
		gui.Visible = false
		Camera.FieldOfView = 70
	end
end

The arms still dont become visible

1 Like

Is there anything showing in output?

nope, nothing in output. Do you want me to put a download to the game?

Sure I can take a look - message me if you prefer.

I think i sent it, tell me if not

I fixed it, i had another script that broke it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.