Fading Parts keep on getting no collided, even with them attached to collision groups

I have a toggle key that when you press it, it makes some parts faded and others not. You can jump on those parts.

There are 2 courses and course 1 works fine, but when you teleport to course 2, it stops colliding (even when unfazed) and it has a collision group, collisions are enabled, I checked everything.

Course 1’s parts are in folders called “GroupA” and GroupB" to tell what parts to fade. Course 2 is stored in a folder called “Course2Parts”, and has 2 folders in it called “GroupA2” and “GroupB2” which also stores the parts for fading and unfading. They are duplicates of the first courses so I don’t know why this is happening.

Mind showing the script so I can help?

We need the code so we can help you but i think when you use TweenService to fade parts by changing their Transparency the physics system doesn’t automatically adjust collision behavior Some developers also accidentally disable CanCollide during tweening for visual effects and then forget to turn it back on or expect collision groups to override it

Are you setting CanCollide whenever Transparency reaches 1?

Check that whatever group your parts are in is still set to collide with the player’s group after switching courses, and the groups are correctly referenced in your toggle logic. If your script is hardcoded to only look for “GroupA” and “GroupB”, it will ignore “GroupA2” and “GroupB2” completely. Rename them to “GroupA” and “GroupB” inside each course folder.

local UserInputService = game:GetService(“UserInputService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Players = game:GetService(“Players”)

local player = Players.LocalPlayer
local playerGui = player:WaitForChild(“PlayerGui”)

local optionsGui = playerGui:WaitForChild(“OptionsGui”)
local optionsFrame = optionsGui:WaitForChild(“OptionsFrame”)
local keyInputBox = optionsFrame:WaitForChild(“KeyInputBox”)
local confirmButton = optionsFrame:WaitForChild(“ConfirmButton”)
local closeButton = optionsFrame:WaitForChild(“CloseButton”)
local openOptionsButton = optionsGui:WaitForChild(“OpenOptionsButton”)

local toggleKey = Enum.KeyCode.F
local visibleTransparency = 0
local hiddenTransparency = 0.7
local showGroupA = true

local toggleEvent = ReplicatedStorage:FindFirstChild(“ToggleGroupCollision”)

– dynamically get ALL groups relevant to toggling
local function getGroups()
local groupA = workspace:FindFirstChild(“GroupA”)
local groupB = workspace:FindFirstChild(“GroupB”)
local course2Parts = workspace:FindFirstChild(“Course2Parts”)

local groupA2 = nil
local groupB2 = nil
if course2Parts then
	groupA2 = course2Parts:FindFirstChild("GroupA2")
	groupB2 = course2Parts:FindFirstChild("GroupB2")
end

return groupA, groupB, groupA2, groupB2

end

local function setGroupVisibility(group, visible)
if not group then return end
for _, part in ipairs(group:GetDescendants()) do
if part:IsA(“BasePart”) then
part.Transparency = visible and visibleTransparency or hiddenTransparency
part.CanCollide = visible
end
end
end

local function updateVisibility()
local groupA, groupB, groupA2, groupB2 = getGroups()

setGroupVisibility(groupA, showGroupA)
setGroupVisibility(groupB, not showGroupA)

setGroupVisibility(groupA2, showGroupA)
setGroupVisibility(groupB2, not showGroupA)

end

local function toggleGroups()
showGroupA = not showGroupA
updateVisibility()
if toggleEvent then
toggleEvent:FireServer(showGroupA)
end
end

– call this function after teleport or map load to refresh groups visibility properly
local function refreshGroups()
updateVisibility()
end

– initialize on script start
updateVisibility()

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == toggleKey then
toggleGroups()
end
end)

openOptionsButton.MouseButton1Click:Connect(function()
optionsFrame.Visible = true
end)

closeButton.MouseButton1Click:Connect(function()
optionsFrame.Visible = false
end)

confirmButton.MouseButton1Click:Connect(function()
local text = keyInputBox.Text:upper()
if Enum.KeyCode[text] then
toggleKey = Enum.KeyCode[text]
print(“Toggle key changed to:”, text)
keyInputBox.Text = “”
else
print(“Invalid key:”, text)
keyInputBox.Text = “”
end
end)

optionsFrame.Visible = false

– expose refreshGroups for external calls, e.g., from teleport script:
_G.RefreshFadeToggle = refreshGroups

When it fades, CanCollide is off, vice versa when it isn’t. CanQuery appears which I’m not to familiar with when it is faded.

1 Like

you can use

print("hello!")

image

thanks lol, first time doing this

1 Like

No go. Changing it made the first course break, but was still able to toggle in the second. Interesting thing I just found, I took a part from course 2, dragged it to course 1 and it worked fine. I think it is something with teleportation and how the camera system works just no clue how.

1 Like

It looks like when you fell through the second course’s parts, the parts went transparent, meaning you must have hit the toggle key? I don’t see what’s wrong here, I’m confused??? They look like they go transparent right as you touch them and then become opaque right after you fall through the last one?

I figured it out. It was with the naming of the course folders and parts within it, making it useless for collision. I re-wrote it so it should be a little stream lined and easier.

1 Like