#simple issue but i dont know how to fix?
1 messages · Page 1 of 1 (latest)
game.ReplicatedStorage.death.OnServerEvent:Connect(function(plr)
local leaderstats = plr:WaitForChild("leaderstats")
local time = leaderstats:WaitForChild("Time Alive")
time.Value = 0
end)```
Do humanoid.changed
Do humanoid.died:connect(replicatedevent)
Nuh uh
local character = plr:WaitForChild("Character")
local humanoid = character:WaitForChild("Humanoid")
local death = game.ReplicatedStorage.death
if humanoid.died:connect(death) then
game.ReplicatedStorage.death:FireServer()
end```
ddoesnt work
@steep marten
humanoid.Died:Connect(function()
game:GetService("ReplicatedStorage):WaitForChild("death"):FireServer()
end)```
@calm finch
ohh
yeshir
local leaderstats = plr:WaitForChild("leaderstats")
local time = leaderstats:WaitForChild("Time Alive")
time.Value = 0
end)```
is this correct?
it doesnt reset time
can you check if this works
@steep marten
this is another script
instead of game.replicated storage do game:getservice("replicatedstorage)
this is a local script in the startercharacterscripts
is that ok?
oh
let me screen shot my explorer
yes
startercharacterscripts are a child of the character
which is a child of the workspace
localscripts dont run on the workspace
mm
move the script to replicated storage or replicated first or smth
Alright ill move it to replicated storage
first
i mean
still doesnt work
thats strange
thats all that runs
uhh
oh ok
local plr = game.Players.LocalPlayer
local character = plr:WaitForChild("Character")
local humanoid = character:WaitForChild("Humanoid")
local death = game.ReplicatedStorage.death
humanoid.Died:Connect(function()
game:GetService("ReplicatedStorage"):WaitForChild("death"):FireServer()
end)
os it here?
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local deathEvent = ReplicatedStorage:WaitForChild("death")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function()
deathEvent:FireServer()
end)
this should work
the way they had it was fine i think
humanoid.died and :connect?
** You are now Level 5! **
yea i told him to
he fixed it before i did
than mb
but does it work now?
Is the problem in the local script or the serverscript?
because local script calls the event
but it doesnt reset time
would you guys like me to record a video for you guys to
do u have a remotevent?
see?
yeah
cuz capitals count
death
bro you are not helpint
you might find the problem here
paste the local script ver batim
as it is rn
change line 7 to
local character = player.Character```
ur local script bugin
its bc they didnt update the character reference
other than that itll work
@calm finch
my work here is done
ok
** You are now Level 6! **
np
fs if you ever have a question my dms r open
cuz u load the character only 1 time
instead u should do a function
yes, but the script is still connected to the old character
instead use a function and
player.CharacterAdded
would look something like this
local function characteraddstuff(character)
local humanoid = character:Waitforchild("Humanoid")
deathEvent:FireServer()
end)
end
if player.Character then
characteraddstuff(player.Character)
end
player.CharacterAdded:Connect(characteraddstuff)
** You are now Level 6! **