Hey guys. I am trying to get the medium fading parts (part that fades away when you step on it) to work for my obby. The issue is that the fading parts debounce will not work when multiple players step on it(when a player steps on the part right after another player, only the first player that stepped on the part will have the part fade away for them). The fading away is handled by a local script, and the debounce is handled on the server, which is necessary so that players don’t have to wait for the fading part to reappear from someone else. I have tried looking for other topics and I couldn’t find anything. Main point: How can I make sure that each player does not have to wait for other players for the fading part to fade away?(Not because the fading part disappears for everyone else, but because one player makes the debounce stay active until finished)
Part of Server Script:
--Medium Fading Part
if object:HasTag("MediumFading") then
object.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit:IsA("Part") then
if not MediumFadingPartDebounce[object] then
--print(MediumFadingPartDebounce[object])
MediumFadingPartDebounce[object] = true
--print(MediumFadingPartDebounce[object])
local duration = 1
local status = "Medium"
local player = Players:GetPlayerFromCharacter(hit.Parent)
fading:FireClient(player, object, status, duration)
wait(duration + 1)
MediumFadingPartDebounce[object] = nil
--print(MediumFadingPartDebounce[object])
end
end
end)
end
Handle Fading Local Script:
local TweenService = game:GetService("TweenService")
local PortalRemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("Portal")
local PortalGuiFrame = script.Parent
local LimitPart = game.Workspace:WaitForChild("Lobby"):WaitForChild("AfterWinLimitPart")
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
true
)
local tween = TweenService:Create(PortalGuiFrame, tweenInfo, {BackgroundTransparency = 0})
PortalRemoteEvent.OnClientEvent:Connect(function()
print("Activated")
LimitPart.CanCollide = true
PortalGuiFrame.Visible = true
tween:Play()
tween.Completed:Wait()
PortalGuiFrame.Visible = false
wait(0.5)
LimitPart.CanCollide = true
end)
Thank you all