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

Why am I getting this strange error? (Updated script)

Asked by
Chronomad 180
9 years ago

This script is supposed to allow the player to control a custom character. However, whenever it runs I get this : 00:00:38.987 - startScript re-entrancy has exceeded 3 00:00:38.987 - Script 'Players.Player1.Backpack.CharMorph', Line 8

Also, whenever this script is active, it stops a second script from running.

Here is the script.

01local player = game:GetService('Players').LocalPlayer
02local newCharacter = game.ReplicatedStorage.newPlayer:Clone()
03local SpawnLocation = game.Workspace.SpawnLocation
04 
05local debounce = false
06 
07    player.CharacterAdded:connect(function()
08        if not debounce then
09         debounce = true
10 
11        newCharacter.Parent = game.Workspace
12        newCharacter.Name = player.Name
13            player.Character = newCharacter
14            player.CanLoadCharacterAppearance = nil
15        newCharacter.Archivable = false
View all 21 lines...

And here is the second script.

1local Player = game.Players.LocalPlayer
2 
3    Player.Character.Humanoid.Running:connect(function(speed)
4          if speed > 0 then     --Straight from the Wiki!
5            print("Player is running")
6                elseif speed < 1 then
7              print("Player has stopped")
8    end
9end)
0
Maybe because character is a read only property? (just brainstorming) TheDeadlyPanther 2460 — 9y
0
The script works in the sense that it allows the player to control the custom character. However, whenever the script is active, it stops an unrelated script from firing. Chronomad 180 — 9y
0
Does the second script run only once or every time per character loading? This depends on script location and settings. LetThereBeCode 360 — 9y

2 answers

Log in to vote
3
Answered by 9 years ago

From your error, I can assume that you are binding CharacterAdded event to your function which adds a character. What i suggest is adding a debounce.

01local debounce = false
02player.CharacterAdded:connect(function()
03    if not debounce then
04        debounce = true
05 
06        -- code for adding a new character
07 
08        debounce = false
09    end
10end)

Hope this helped.

0
That could likely be the case. I had the same problem when I made a custom character, because when you SET the character property it fires CharacterAdded -- causing the character to be set again, etc. etc. Perci1 4988 — 9y
0
I've added a debounce before and got nothing. I added your code to mine and the result was my client crashing. Chronomad 180 — 9y
0
@Chronomad you probably put it in wrong spot or you didn't post the real relevant code here. LetThereBeCode 360 — 9y
0
I edited the OP with the updated script. Chronomad 180 — 9y
View all comments (2 more)
0
@Chronomad That seems fine, although I see you posted this comment "However, whenever the script is active, it stops an unrelated script from firing." Are you completely sure it's unrelated? I doubt so. LetThereBeCode 360 — 9y
0
I edited the OP again with the second script. Chronomad 180 — 9y
Ad
Log in to vote
-2
Answered by
Sypr 0
9 years ago

what is newplayer in storage? is it a model?

0
Use the comments? And yes it's a model. Chronomad 180 — 9y

Answer this question