so i wanted to make on death gui and trigger events with this script but it isn’t trigger
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character) --every time he spawns
print(player.Name.." has spawned in / respawned")
script.Parent.DeadEnd:Fire()
player.CameraMaxZoomDistance = 0.5
character:WaitForChild("Humanoid").Died:Connect(function() --every time he dies and NOT respawns
print(player.Name.." has died!")
player.CameraMaxZoomDistance = 400
script.Parent.DeadStart:Fire()
end)
end)
end)
function effects()
local deadblur = game.Lighting:FindFirstChild("deadblur")
local deadwb = game.Lighting:FindFirstChild("deadwb")
deadwb:Destroy()
deadblur:Destroy()
end
script.Parent.DeadStart.Event:Connect(effects)
function gui()
script.Parent.Parent.Parent.Loading.Enabled = true
script.Parent.Parent.Parent.MainGui.Enabled = true
script.Parent.Parent.Parent.portrait.Enabled = true
end
script.Parent.DeadStart.Event:Connect(gui)
function timee()
script.Parent.time.Text = 0
end
script.Parent.DeadStart.Event:Connect(timee)
script.Parent.Parent.Parent.DeathGui.Enabled = false
I assume this is a script and the other one is a local script right? Because if not, the first one must be a script in order to work (also then change it to a remote event)
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character) --every time he spawns
print(player.Name.." has spawned in / respawned")
script.Parent.DeadEnd:Fire()
player.CameraMaxZoomDistance = 0.5
character:WaitForChild("Humanoid").Died:Connect(function() --every time he dies and NOT respawns
print(player.Name.." has died!")
player.CameraMaxZoomDistance = 400
script.Parent.DeadStart:Fire()
end)
end)
end)
local players = game:GetService("Players")
local deadEnd=Instance.new("RemoteEvent",game:GetService("ReplicatedStorage"))
deadEnd.Name="DeadEnd"
local deadStart=Instance.new("RemoteEvent",game:GetService("ReplicatedStorage"))
deadStart.Name="DeadStart"
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character) --every time he spawns
print(player.Name.." has spawned in / respawned")
deadEnd:FireClient(player)
--player.CameraMaxZoomDistance = 0.5 move this to localscript
character:WaitForChild("Humanoid").Died:Connect(function() --every time he dies and NOT respawns
print(player.Name.." has died!")
--player.CameraMaxZoomDistance = 400 move this to localscript too
deadStart:FireClient(player)
end)
end)
end)
function gui()
script.Parent.Parent.Parent.Loading.Enabled = true
script.Parent.Parent.Parent.MainGui.Enabled = true
script.Parent.Parent.Parent.portrait.Enabled = true
end
like what the heck is this
and he put it into ServerScriptService god damn it the one handling effects should be LocalScript
also Parent.Parent.Parent spam
from localscript he should get PlayerGui like this
local lplr=game:GetService("Players").LocalPlayer
local plrgui=lplr:WaitForChild("PlayerGui") and lplr:FindFirstChildOfClass("PlayerGui")
plrgui.MainGui.Enabled = true
plrgui.portrait.Enabled = true
plrgui.Loading.Enabled = true