Shockwave doesn't make all Character invisible

  1. What do you want to achieve? Keep it simple and clear!

Hello, I want to make a Shockwave that make all players transparent in the server.

  1. What is the issue? Include screenshots / videos if possible!

there is no error the problem is that it doesn’t make all the character transparent when the shockwave touches them.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have tried looking for solutions on google and devforum but could not find a way to fix this.

local UIS = game:GetService("UserInputService")
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local SpawnLocation = game.Workspace:WaitForChild("SpawnLocation")
local tween = game:GetService("TweenService")
local LocalPlayers = game:GetService("Players")
local Explosion = game.Workspace:WaitForChild("explosion2")
local Nuke = game.Workspace:WaitForChild("Nuke")
local MyID = 1533601134

local CharBodyParts = {
	["Head"] = false;
	["LeftFoot"] = false;
	["LeftHand"] = false;
	["LeftLowerArm"] = false;
	["LeftLowerLeg"] = false;
	["LeftUpperArm"] = false;
	["LeftUpperLeg"] = false;
	["LowerTorso"] = false;
	["RightFoot"] = false;
	["RightHand"] = false;
	["RightLowerArm"] = false;
	["RightLowerLeg"] = false;
	["RightUpperArm"] = false;
	["RightUpperLeg"] = false;
	["UpperTorso"] = false;
	["HumanoidRootPart"] = false
}


RemoteEvent.OnServerEvent:Connect(function(player)
	local Character = player.Character
	
		local Part = Instance.new("Part")

		Part.Shape = Enum.PartType.Ball
		Part.Material = Enum.Material.ForceField
		Part.CFrame = SpawnLocation.CFrame
		Part.Name = "IDK"
		Part.Anchored = true
		Part.CanCollide = false
		Part.CastShadow = false
		Part.Parent = game.Workspace.PT

		local PartGoal = TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0.2)
		local PartProperty = {Size = Vector3.new(179, 179, 179), Color = Color3.fromRGB(229, 76, 0)}
		local PartX = tween:Create(Part, PartGoal, PartProperty)

		PartX:Play()
		Explosion:Play()

Part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid  then
			for _,Char in pairs(Character:GetChildren()) do
				if Char.Name == CharBodyParts then
					Char.Transparency = 1
					print("BOMB!")
				end
			end
		end
	end)
end)
1 Like

You’re checking if Char.Name is equal to the table, which it obviously isn’t.

Replace your touched event with this:

Part.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid  then
		for _,Char in pairs(hit.Parent:GetChildren()) do
			if Char:IsA("MeshPart") then
				Char.Transparency = 1
			end
		end
	end
end)

Try this and let me know if it works.

1 Like

Hey! Tysm it works!! I luv you :heart:

1 Like

No worries! Good luck developing!

Hey, I encounter another problem can u please help me?

I have the debounce on but why does it still not work?

Can you show me the other code?

here you go

-- ServerScript

local UIS = game:GetService("UserInputService")
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local SpawnLocation = game.Workspace:WaitForChild("SpawnLocation")
local tween = game:GetService("TweenService")
local LocalPlayers = game:GetService("Players")
local Explosion = game.Workspace:WaitForChild("explosion2")
local Debounce = false
local DoomEvent = game.ReplicatedStorage:WaitForChild("DoomSound")


RemoteEvent.OnServerEvent:Connect(function(player)
	local Character = player.Character
	
		local Part = Instance.new("Part")
		local C4 = Instance.new("Explosion")

		Part.Shape = Enum.PartType.Ball
		Part.Material = Enum.Material.ForceField
		Part.CFrame = SpawnLocation.CFrame
		Part.Name = "IDK"
		Part.Anchored = true
		Part.CanCollide = false
		Part.CastShadow = false
		Part.Parent = game.Workspace.PT

		local PartGoal = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0.2)
		local PartProperty = {Size = Vector3.new(179, 179, 179), Color = Color3.fromRGB(229, 76, 0)}
		local PartX = tween:Create(Part, PartGoal, PartProperty)

		PartX:Play()
		Explosion:Play()
Part.Touched:Connect(function(hit)
	if Debounce == false then
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if humanoid  then
			C4.BlastPressure = 20000
			C4.BlastRadius = 20000
			C4.Parent = Character.HumanoidRootPart
			DoomEvent:FireAllClients()
			Debounce = true
			print(Debounce)
			end
		end
		task.wait(5)
		Debounce = false
		print(Debounce)
		Part:Destroy()
	end)
end)
-- localscript

local UIS = game:GetService("UserInputService")
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local player = game.Players.LocalPlayer
local Doom = game.Workspace:WaitForChild("Explosion")
local DoomEvent = game.ReplicatedStorage:WaitForChild("DoomSound")
local MyID = 1533601134
local CanUse = false
local Character = player.Character

DoomEvent.OnClientEvent:Connect(function()
	Doom:Play()
end)

UIS.InputBegan:Connect(function(Input, chat)
	if Input.KeyCode == Enum.KeyCode.F and 
		player.UserId == MyID and 
		not chat and
		CanUse == false then 
		print("Player Matched!")
		RemoteEvent:FireServer()
		for i = 0,25 do
			CanUse = true
			print("Please wait for " .. i)
			task.wait(5)
			CanUse = false
			Doom:Stop()
		end
	end
end)

Hey, I manage to get it fixed. What I did was I disconnect the event so the event doesn’t listen out for touches.

Thank you tho I appreciate your help! :slight_smile:

1 Like