I want the function to fire an event and respawn the player but nothing runs under LoadCharacter. are there any better alternatives to respawn character or am I doing something wrong?
BotanicalEntitySpawner.OnServerEvent:Connect(function(plr: Player, targetPlayer: Player, reason: string, _time: number)
if plr then
BerserkEvent:FireClient(plr, reason, _time)
plr:LoadCharacter()
print("helloo you are print?")
end
end)
It works when the character is R6 but I need it to run on R15 characters
Try putting the print before loading the character, to see if it has something to do with plr being nil or yield on BerserkEvent, using prints to debug is also a good idea.
Also, is it a local script? If so, is it in StarterCharacterScripts?
I don’t know what causes it not to print but It is fixed when the game is R6.
Is there some kind of yield on LoadCharacter when the character is R15 that I don’t know of?
Anyways my problem is yet not solved since I’m trying to work with R15 Characters
Do you have CharacterAutoLoads to false? Also loading the character will destroy the script, because that’s a script in the character, so it will stop running.
Maybe theres a yield on BerserkEvent that causes it to stop cuz it is waiting for a part on the character which only exists on R6, also what does BerserkEvent do exactly?
Hm… Does it actually load the character? If not, it may be a yield on whatever script is firing the RemoteEvent, if it is loading the character, then I have no idea why it isn’t working. Im gonna open studio to try and see if it works, it may take a while cuz my laptop is busted
He said it was a script, and even if the localscript who fired the event got destroyed, it should still print. And I tried it on studio rn, and it works perfectly fine
Apologies I missed that. Moved the script off somewhere ensuring it wouldn’t be in character (was inside a Tool before) and it works. Much appreciated man!