Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

LocalScript breaking right after a player joins and uses it?

So, I have a script that shoots a bullet when a tool is selected and the mouse is clicked. The script itself works fine. But right after a player joins and uses it, just like 1 second after he/she joins, the localscript just breaks. Is there a statement that can prevent this from happening?

3 comments

1

You need to share the code and the error. There isn't a fixbugs() line -- because the bug is there because you told Lua that's what you want it to do.

0

Are you sure? Because the script relies on another script and together they add up to 100+ lines. Also, there's no error in the output.

0

P.S., I didn't want a statement that just fixes the problem. I want a statement that lets the character load before the script does its thing.

1 answer

You need to be more specific when asking your questions. If your third comment to your Question had been your Question, we wouldn't have had a problem.

Anyway;

local player = game.Players.LocalPlayer
local character = player.Character
if not character then --If you manually LoadCharacter, this script will sometimes run the first time before a Character exists at all.
	player.CharacterAdded:wait()
	character = player.Character
end
while not character.Parent do wait() end

This discussion is preserved as it was. New answers, comments, and votes are closed.