Untitled
unknown
plain_text
a year ago
3.1 kB
4
Indexable
local replicated = game:GetService('ReplicatedStorage') local players = game:GetService('Players') local aedEvent = replicated:WaitForChild('aedEvent') local Config = require(script:WaitForChild("Config")) local ReviveAnimation = script:WaitForChild("ReviveAnimation") local pNotifyStorage = replicated:WaitForChild("pNotifyStorage") local pNotifyEvent = pNotifyStorage:WaitForChild("pNotifyEvent") local VoiceChat = replicated:FindFirstChild("VoiceChatFix") local debounceCache = {} local _settings = { requireToolName = 'AED', } aedEvent.OnServerEvent:Connect(function(player, mouseTarget) if debounceCache[player.UserId] then return end debounceCache[player.UserId] = true task.delay(2, function() debounceCache[player.UserId] = nil end) if not mouseTarget or not player.Character or (player.Character and not player.Character:FindFirstChild('Humanoid')) then return end -- [[ เช็คว่าผู้เล่นมีเลือดมากกว่า 1 หรือไม่ ]] -- if player.Character:FindFirstChild('Humanoid').Health < 1 then return end -- [[ เช็คว่าผู้เล่นถือ Tool อยู่หรือไม่ ]] -- if not player.Character:FindFirstChild(_settings.requireToolName) then return end if mouseTarget:FindFirstAncestorWhichIsA('Model') and players:GetPlayerFromCharacter(mouseTarget:FindFirstAncestorWhichIsA('Model')) then local targetPlayer = players:GetPlayerFromCharacter(mouseTarget:FindFirstAncestorWhichIsA('Model')) local distance = (player.Character:WaitForChild('HumanoidRootPart').Position - targetPlayer.Character:WaitForChild('HumanoidRootPart').Position).Magnitude if targetPlayer.Character and distance and distance <= 50 and targetPlayer.Character:FindFirstChild('Humanoid') and targetPlayer.Character:FindFirstChild('Humanoid').Health <= 0 then player.Character.PrimaryPart.Anchored = true player.Character.Humanoid:LoadAnimation(ReviveAnimation):Play() task.wait(Config.ReviveTime) -- [[ หยุด animation track ทั้งหมดของคนที่ชุบ ]] -- for i, track in player.Character.Humanoid:GetPlayingAnimationTracks() do track:Stop() end player.Character.PrimaryPart.Anchored = false targetPlayer:LoadCharacter() targetPlayer.Character:PivotTo(player.Character:WaitForChild('HumanoidRootPart').CFrame * CFrame.new(0, 1, -3)) VoiceChat:FireClient(targetPlayer) pNotifyEvent:FireClient(targetPlayer, "Success", "System", "คุณถูกช่วยให้ฟื้น") targetPlayer.PlayerGui.DiedUI.ToggleUis:FireClient("Toggle") local targetMoney = targetPlayer:FindFirstChild('ITEM'):FindFirstChild('Money') local playerMoney = player:FindFirstChild('ITEM'):FindFirstChild('Money') targetMoney.Value = targetMoney.Value - 900 playerMoney.Value = playerMoney.Value - 900 targetPlayer:FindFirstChild("System"):FindFirstChild("isanonymous").Value = false end end end)
Editor is loading...