When Player dies, starterpack local scripts stop working

GAME: Spiderman - Roblox

So, i choose ‘starterpack’ bcause StarterPlayer doesn’t like appropriate and doesnt work

as soon as the player dies the script disappears or stops working.

i tried something like ‘plr.CharacterAdded’ but doesn’

After that, in both platforms doesn’t work
-Roblox Launcer
-Roblox Studio

Put the LocalScripts in StarterPlayerScripts. It should work perfectly fine.

2 Likes

I mean, maybe?

There are basically no details in this post, hard to say.

1 Like

updated the post …

Still try what I suggested. The way you said it, you put the scripts in StarterPlayer, not StarterPlayerScripts. StarterPlayerScripts is the appropriate parent for a player’s LocalScripts.

1 Like

Are you sure you used a local script and not a server script? The reason it might work in starterpack and not in starterplayer is because it’d get cloned in player’s backpack and server scripts can run in there and the reason it “stops running” once you reset is because server scripts only run once the server starts and don’t stop.

1 Like

the script works even after changing his directory, but as nothing is perfect, when I died the script disappeared, it stopped working

so i dont know much how to program scripts
the script is an press key to animate and the others are punch, kick etc
so, i changed starterpack to starterplayer and the same error happen

I don’t know if server script means when the server receives data from the keys pressed by the player or if the player presses the key and activates an event on the server. I also have doubts about a backpack datastore like

This shouldn’t happen usually. You are saying that you moved the LocalScripts into StarterPlayer, but try StarterPlayerScripts (Inside StarterPlayer).

1 Like

yeah it are already in, i forgot writting scripts

Check and see if the scripts are replicating into the player’s PlayerScripts before, and after you die.

1 Like

Here goes the game: Spiderman - Roblox so ok it is ridiculous game but, press F , E , Q and other buttons

they keep in player’s scripts.
i dont know if it matter but the local script function is to press to animate

So is the issue solved? Your problem that you stated is that scripts are removing themselves when the player dies, so what the script does is irrelevant.

1 Like

i doesnt speak english but the term removing themselves are not appropriate so ill use : they stop working when player dies

Is the script supposed to run when an event triggers? I’d like to see the script to help.

1 Like
> --//Services
> 
> local UserInputService = game:GetService("UserInputService")
> 
> --//Debounces
> 
> local punching = false
> 
> --//Player
> 
> local Player = game.Players.LocalPlayer
> 
> local Character = game.Workspace:WaitForChild(Player.Name)
> 
> local Humanoid = Character:FindFirstChildOfClass("Humanoid")
> 
> --//Animations
> 
> Punch = Instance.new("Animation")
> 
> Punch.AnimationId = "rbxassetid://DOESNT MATTER"
> 
> PunchTrack = Humanoid:LoadAnimation(Punch)
> 
> --//Coding
> 
> UserInputService.InputBegan:Connect(function(Input)
> 
> if Input.KeyCode == Enum.KeyCode.F and not punching then
> 
> PunchTrack:Play()
> 
> end
> 
> end)

To me, it looks like the animation never gets added to the player’s character when they respawn. Fix that and see what happens.

1 Like

how i fix that? doing an repeat wait until? if this is the solution i dont know how to write

Just make a CharacterAdded event and add the animation when it triggers.

1 Like