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

I'm making a rock disapear when I hit it a couple of times and come back. But doesn't come back?

The weird thing is that in the output it says it's transparency is '0', but I still cant see it.

This is the local script inside the tool.

tool.HitPoint.Touched:connect(function(hit)
	if not touchedRock then
		touchedRock = true
		if hit.Parent == iron and mining == true then
			rep.IronRustyPickaxe:FireServer()
			hitCount = hitCount + 1
			print(hitCount)
			if hitCount >= 5 then
				for i, child in ipairs(wholeRock)do
					child.Transparency = 1
					print(child.Name.." "..child.Transparency)
					child.CanCollide = false
					print("Invisable"..child.Name)
				end
				rep.IronRockRespawn:FireServer()
				print("Fire Event")
			end
		end
		wait(1)
		touchedRock = false
	end
end)

This is the script in the ServerScriptService

local repStrg = game.ReplicatedStorage
local realRock = game.Workspace.IronRock1
local wholeRock = realRock:GetChildren()

game.ReplicatedStorage.IronRockRespawn.OnServerEvent:Connect(function()
	wait(1)
	for i, child in ipairs(wholeRock) do
		child.Transparency = 0
		print(child.Name..(" ")..child.Transparency)
		child.CanCollide = true
		print("vissable:"..child.Name)
	end
	print("Visible")
end)

Here is the output

20:19:43.303  Rock1 1  -  Client - PickAxeLocalScript:62
  20:19:43.303  InvisableRock1  -  Client - PickAxeLocalScript:64
  20:19:43.303  Ore2 1  -  Client - PickAxeLocalScript:62
  20:19:43.303  InvisableOre2  -  Client - PickAxeLocalScript:64
  20:19:43.303  Ore3 1  -  Client - PickAxeLocalScript:62
  20:19:43.303  InvisableOre3  -  Client - PickAxeLocalScript:64
  20:19:43.304  Ore4 1  -  Client - PickAxeLocalScript:62
  20:19:43.304  InvisableOre4  -  Client - PickAxeLocalScript:64
  20:19:43.304  Ore5 1  -  Client - PickAxeLocalScript:62
  20:19:43.305  InvisableOre5  -  Client - PickAxeLocalScript:64
  20:19:43.305  Ore6 1  -  Client - PickAxeLocalScript:62
  20:19:43.305  InvisableOre6  -  Client - PickAxeLocalScript:64
  20:19:43.305  Ore7 1  -  Client - PickAxeLocalScript:62
  20:19:43.305  InvisableOre7  -  Client - PickAxeLocalScript:64
  20:19:43.306  Ore1 1  -  Client - PickAxeLocalScript:62
  20:19:43.306  InvisableOre1  -  Client - PickAxeLocalScript:64
  20:19:43.306  Fire Event  -  Client - PickAxeLocalScript:67
  20:19:43.383  It's mineable!  -  Server - HitPointPickaxe:20
  20:19:43.383  Sound played  -  Server - HitPointPickaxe:22
  20:19:44.335  Rock1 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Rock1  -  Server - MainIronRockScript:11
  20:19:44.335  Ore2 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Ore2  -  Server - MainIronRockScript:11
  20:19:44.335  Ore3 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Ore3  -  Server - MainIronRockScript:11
  20:19:44.335  Ore4 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Ore4  -  Server - MainIronRockScript:11
  20:19:44.335  Ore5 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Ore5  -  Server - MainIronRockScript:11
  20:19:44.335  Ore6 0  -  Server - MainIronRockScript:9
  20:19:44.335  vissable:Ore6  -  Server - MainIronRockScript:11
  20:19:44.335  Ore7 0  -  Server - MainIronRockScript:9
  20:19:44.336  vissable:Ore7  -  Server - MainIronRockScript:11
  20:19:44.336  Ore1 0  -  Server - MainIronRockScript:9
  20:19:44.336  vissable:Ore1  -  Server - MainIronRockScript:11
  20:19:44.336  Visible  -  Server - MainIronRockScript:13

When it says eg. "Ore2 1". you can see in the script that 'Ore2' is the child and '1' is the transparency.

1 answer

I changed the transparency in the ServerScriptService script to '0.01' intstead of '0' and I can see it now.

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