RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"give me the entire script to copy and paste"
Here is the entire script: ```lua local playersOnMat = {} local mat = script.Parent local function updateGui() -- update the GUI with the number of players on the mat end local function onPlayerEntered(otherPart) local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if humanoid then local player = game.Players:GetPlayerFromCharacter(humanoid.Parent) if player then playersOnMat[player] = true updateGui() end end end local function onPlayerLeft(otherPart) local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if humanoid then local player = game.Players:GetPlayerFromCharacter(humanoid.Parent) if player then playersOnMat[player] = nil updateGui() end end end mat.Touched:Connect(onPlayerEntered) mat.TouchEnded:Connect(onPlayerLeft) ``` Please replace `updateGui()` with your own function to update the GUI with the number of players on the mat.