Tweening Transparency on a touch

Also go into StarterPlayer and find something called “DevCameraOcclusionMode”
Try changing it to “Invisicam” and test it.

Sorry, made a typo. Fixed now*

Invisicam does what you want to.

1 Like

So I’m a bit confused. I have 3 codes:

Mine:

local roof = script.Parent.Roof

Info = TweenInfo.new(1)
local TweenIn = game:GetService("TweenService"):Create(roof,Info,{Transparency=0})
local TweenOut = game:GetService("TweenService"):Create(roof,Info,{Transparency=1})
local detection1 = script.Parent.Touch1
local detection2 = script.Parent.Touch2

local touching = false

detection1.Touched:Connect(function()
	detection1.CanTouch = false
	if touching == false then
		touching = true
		TweenOut:Play()
	else
		touching = false
		TweenIn:Play()
	end
	wait(1)
	detection1.CanTouch = true
end)

detection2.Touched:Connect(function()
	detection1.CanTouch = false
	if touching == false then
		touching = true
		TweenOut:Play()
	else
		touching = false
		TweenIn:Play()
	end
	wait(1)
	detection1.CanTouch = true
end)```

And add this:

local debounce = false
–Function
if not debounce then
debounce = true
task.wait(time_here)
debounce = false
end

How do I combine the two?

It isn’t a code.
Scroll down in Explorer and find StarterPlayer.
Click StarterPlayer and in Properties, find the “DevCameraOcclusionMode”
Switch it to “invisicam”.

Should work.

What does this do?

My game has not changed

If I remember correctly, if there is a roof above you, the roof will become translucent.

It’s basically what you need.

Wait I know why

Give me 1 minute

I have a code that makes it so the player has a camera that is a top down-view cam so it is not the original camera.

That is why the setting does not work

1 Like

May be why.
Try turning it off for now and try the Invisicam option.

Yes but that ruins my game. The player should not have the option to rotate nor move their camera

Here is the code for the cam script:

local cam = workspace.CurrentCamera

local Player = game.Players.LocalPlayer

local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")


cam.CameraType = Enum.CameraType.Scriptable


local cameraPart = Instance.new("Part")
cameraPart.Transparency = 1
cameraPart.CanCollide = false
cameraPart.Parent = workspace
cameraPart.Name = "cameraPart"

cameraPart.CFrame = CFrame.new(hrp.Position + Vector3.new(0, 40, 0), hrp.Position)

local bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bp.Parent = cameraPart


game:GetService("RunService").RenderStepped:Connect(function()

	bp.Position = hrp.Position + Vector3.new(0, 50, 0)

	cam.CFrame = cameraPart.CFrame
end)

I meant for now as in for a test run without the camera.
Also try running the game with invisicam on and look in Explorer while testing.
Then go to Players and find yourself.
Look in StarterGUI for any script that might be related to invisicam.

Why do I sound like I’m sponsored by invisicam lol?


I found this if it helps at all.
It’s in that folder.

Dude I am saying I have tried that and again It works, BUT it ruins the game.\

Do you think I could make a part follow the player and make it so if the part collides with another, That other part becomes transparent?

That does sound like a solution.

game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
local HRP = c.PrimaryPart
local part = Instance.new(“Part”)
part.Transparency = 1
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(8,20,8)

while task.wait(0.5) do
part.Position = HRP.Position + Vector3.new(0,30,0)
end
end)
end)

It would be a bit janky when doing the whole transparency thing though. Nevermind on the part idea.

what code do you have so far?

character limit :slightly_smiling_face:

Could you paste in the Invisicam Module script? Maybe I could adjust it to fit.
I sent an image above on where it is.

Found another thing that might work. Bit complicated though.

local function XRay(castPoints, ignoreList)
	ignoreList = ignoreList or {}
	local parts = workspace.CurrentCamera:GetPartsObscuringTarget(castPoints, ignoreList)

	for _, part in pairs(parts) do
		part.LocalTransparencyModifier = 0.75
		for _, child in pairs(part:GetChildren()) do
			if child:IsA("Decal") or child:IsA("Texture") then
				child.LocalTransparencyModifier = 0.75
			end
		end
	end
end

XRay({ Vector3.new() })

Where should I put this code?

Character limit

It would be a script that is always active so probably best a localscript in StarterGUI or StarterCharacterScripts.


local function XRay(castPoints, ignoreList)
	ignoreList = ignoreList or {}
	local parts = workspace.CurrentCamera:GetPartsObscuringTarget(castPoints, ignoreList)

	for _, part in pairs(parts) do
		part.LocalTransparencyModifier = 0.75
		for _, child in pairs(part:GetChildren()) do
			if child:IsA("Decal") or child:IsA("Texture") then
				child.LocalTransparencyModifier = 0.75
			end
		end
	end
end

while task.wait(0.3) do
XRay(script.Parent.PrimaryPart)
end

Put in StarterCharacterScripts inside of StarterPlayer.

Also congrats, you’re my most replied to :grinning: