#Exp help
63 messages · Page 1 of 1 (latest)
script.Parent.Humanoid.Died:Connect(function()
end)
in the humanoid there is a die event
you can use it
so like this? ```local db = false
script.Parent.Humanoid.Died:Connect(function()
end)
if not db then
db = true
game.ReplicatedStorage.AddExp:FireServer()
wait(.5)
db = false
end```
hum
hm doesnt work
no
Your end is not in the right spot
yes put the end) at the end
scope error
oops
script.Parent.Humanoid.Died:Connect(function()
if not db then
db = true
game.ReplicatedStorage.AddExp:FireServer()
wait(.5)
db = false
end
end)
like this
yes
still doesnt work
show how you recieve the event and if there is any logs
there are no errors in the logs/output
** You are now Level 4! **
show the part where you recieve the event
brb
script.Parent.Humanoid.Died:Connect(function()
print("test")
if not db then
db = true
game.ReplicatedStorage.AddExp:FireServer()
wait(.5)
db = false
end
end)
like this right
@empty palm
i dont see the print in the output
can you show where the script is located
mmh thats weird
Local scripts do not run unless they are descendants of a client
@true lodge
I mean unless you change the run context
so i should use a normal script?
but the first script the original i posted in the first message works with an local script
on the original script i used an textbutton
Text button is parented to a screengui
Which is parented under a PlayerGUI
which is parented under a player (client)
For a local script to run, it has to be under StarterPlayerScripts/PlayerScripts, StarterCharacterScript/Player.Character,
StarterGUI/PlayerGui,
StarterPack/Player.Backpack,
ReplicatedFirst
so i should use an normal script or what do you mean`?
And I believe replicated storage
Well what is your end goal
i want to do an level sysstem if you kill an enemy you get xp
Okay you probably want to do a server script
Hold on
I will try this later thanks
you shouldnt have exp giver with a remote
alright, thanks i do it without remote now
okay i made it new without remote events it looks like this now but doesnt work anyone know why? @lime timber @empty palm @broken fractal ```local Debounce = false
script.Parent.Humanoid.Died:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
if Debounce == false then
Debounce = true
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
Player.leaderstats.Exp.Value += 10
wait(1)
Debounce = false
end
end
end)```
what script where
i think you are checking if the humanoid exists after it dies , and when a npc/player dies, its humanoid gets destroyed