Spaces:
Configuration error
Configuration error
Download PostcardTrigger.server.lua from arnaupq2/RobloxVideoRO: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/arnaupq2/RobloxVideoRO/resolve/main/PostcardTrigger.server.lua
- Command line
-
hf download hf://spaces/arnaupq2/RobloxVideoRO/PostcardTrigger.server.lua
-
curl -L -o PostcardTrigger.server.lua https://huggingface.co/spaces/arnaupq2/RobloxVideoRO/resolve/main/PostcardTrigger.server.lua
1.31 kB
| -- PostcardTrigger.server.lua | |
| -- Colocar en: ServerScriptService | |
| -- | |
| -- Detecta cuando un jugador toca la parte "PanelPostcard" que debe existir | |
| -- directamente en Workspace, y avisa a SU cliente (vía RemoteEvent) para que | |
| -- arranque la reproducción del video a pantalla completa. | |
| local Players = game:GetService("Players") | |
| local ReplicatedStorage = game:GetService("ReplicatedStorage") | |
| -- Crea (o reutiliza) el RemoteEvent que usamos para avisar al cliente | |
| local remoteEvent = ReplicatedStorage:FindFirstChild("PlayPostcardVideoEvent") | |
| if not remoteEvent then | |
| remoteEvent = Instance.new("RemoteEvent") | |
| remoteEvent.Name = "PlayPostcardVideoEvent" | |
| remoteEvent.Parent = ReplicatedStorage | |
| end | |
| local panel = workspace:WaitForChild("PanelPostcard") | |
| local debounceByPlayer = {} | |
| local function onTouched(hit) | |
| local character = hit.Parent | |
| if not character then | |
| return | |
| end | |
| local humanoid = character:FindFirstChildOfClass("Humanoid") | |
| if not humanoid then | |
| return | |
| end | |
| local player = Players:GetPlayerFromCharacter(character) | |
| if not player then | |
| return | |
| end | |
| if debounceByPlayer[player.UserId] then | |
| return | |
| end | |
| debounceByPlayer[player.UserId] = true | |
| remoteEvent:FireClient(player) | |
| task.delay(2, function() | |
| debounceByPlayer[player.UserId] = nil | |
| end) | |
| end | |
| panel.Touched:Connect(onTouched) | |