PlatformClient - Styxling/Feather GitHub Wiki
The PlatformClient module manages interactive platforms in your game. It automatically creates detection parts for platform objects tagged as "Platforms", and uses these detection parts with RegionService3 to determine if the player is above a platform. Based on the player's position, it updates the collision settings of the platforms.
Overview
-
Platform Class:
Wraps an individual platform part.- Detection Part: For each platform, a transparent, non-colliding detection part is created above it.
- Shape-Specific Setup: The detection part is set up differently for block platforms versus cylinder platforms.
-
PlatformClient Class:
Manages a collection of platform objects.- CollectionService Integration: Automatically initializes platforms tagged with
"Platforms"and listens for additions and removals. - Player Collision Updates: Listens for the player's character respawn and updates platform collisions based on whether the player’s
HumanoidRootPartis detected within the platform’s detection area.
- CollectionService Integration: Automatically initializes platforms tagged with
Usage Example
local Directory = require(ServerStorage.Directory.MainModule)
local PlatformClient = Directory("_replicated", "PlatformClient")
local client = PlatformClient.new()
-- Update platform collisions on every heartbeat (or as needed)
local RunService = game:GetService("RunService")
RunService.Heartbeat:Connect(function()
client:updatePlatformCollisions()
end)