Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Remote event doesn't fire on player died on actual game?

Asked by 5 years ago

Local Script

player = game.Players.LocalPlayer
player.Character:WaitForChild("Humanoid").Died:Connect(function()
    game.ReplicatedStorage.RemoteEvents.characterAdded:FireServer()
    wait(0.1)
end)

Script

game.ReplicatedStorage.RemoteEvents.characterAdded.OnServerEvent:Connect(function(player)
    local playerName = player.Name
    workspace:WaitForChild(playerName)
    repeat wait() until player.Character
        local Str = player.Stats.Strength.Value
        local Agi = player.Stats.Agility.Value
        local Int = player.Stats.Intelligence.Value
        local Def = player.Stats.Defense.Value
        local Vit = player.Stats.Vitality.Value
        local Dex = player.Stats.Dexterity.Value
        print(Str)
    workspace:FindFirstChild(playerName).Humanoid.MaxHealth = workspace:FindFirstChild(playerName).Humanoid.MaxHealth+(2*Str)+(4*Vit)
    workspace:FindFirstChild(playerName).Humanoid.Health = workspace:FindFirstChild(playerName).Humanoid.MaxHealth
end)

it doesn't print anything. I'm starting to loathe this client-server relationship thing T_T

0
no errors btw xxXTimeXxx 101 — 5y

Answer this question