Trying To Make Disable/Enable blood button

Im Trying To Make A blood toggle button but it does not work

theres a localscript checks if the blood is off and if it is makes them transparent but it says tried to index transparency (and its in replicated first)
The Script:

local bloodfolder = game.Workspace:WaitForChild(“BloodDebris”)

bloodfolder.ChildAdded:Connect(function(instance)
print(instance.Name)
if game.Players.LocalPlayer.PlayerGui:WaitForChild(“settings”).Values.blood.Value == false then
if instance.Name == “Drop” then
instance:FindFirstChildWhichIsA(“Trail”).Transparency = 1
else
instance:FindFirstChildWhichIsA(“Decal”).Transparency = 1
end
end
end)

FindFirstChildWhichIsA ??? I’ve never used that, but, consider checking this out.

random thread i found:

Thank you But I Already Knew That I Was Trying To Get The instances inside the drop and the blood

I usually use FindFirstChildOfClass()

local bloodfolder = game.Workspace:WaitForChild(“BloodDebris”)

bloodfolder.ChildAdded:Connect(function(instance)
  print(instance.Name) -- lots to fix in this code im noticing as i fix

  if game.Players.LocalPlayer.PlayerGui:WaitForChild(“settings”).Values.blood.Value == false then
  	if instance.Name == “Drop” then -- i dont know if there capilization of spelling issues
  		local drop = instance.Name
drop.Transparency = 1

  	elseif instance.Name == "Decal" then
  		local decal = instance.Name
  		decal.Transparency = 1
  	end
  else 
  	print("AHHHH!!!")    
  end
end)

check ur prints lol, i wrote this via forums so it prob has end, formatting errors and stuff

nevermind i only had to make it waitforchild and the trail transparency number sequence

local bloodfolder = game.Workspace:WaitForChild(“BloodDebris”)

bloodfolder.ChildAdded:Connect(function(instance)
print(instance.Name) – lots to fix in this code im noticing as i fix

if game.Players.LocalPlayer.PlayerGui:WaitForChild(“settings”).Values.blood.Value == false then
if instance.Name == “Drop” then – i dont know if there capilization of spelling issues
instance:WaitForChild(“Trail”).Transparency = NumberSequence.new(1)
else
instance:WaitForChild(“Decal”).Transparency = 1
end
end
end)

1 Like

I’d still considering naming your instances via the if statement, or something close.

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