I have a bunch of scripts, all running at the beginning of the game, and usually, they all run; but sometimes certain scripts won’t run at all. I’m pretty sure that there is nothing wrong with my code, but every time I think there is, adding a wait fixes the problem, or makes my game run more often successfully. I know if I just keep adding waits to my script it will more often run correctly, but the costs of using wait a bunch are slowly building up and I feel like their might be a better way I’m unsure of. Is anyone else having this problem? I haven’t seen anything on the dev forum and I really don’t want to keep adding waits.
Try to make sure you saved the script. Without saving it to the data then it will not allow you to run. It’s happened a lot.
I saved the game before running a script, but I still have the same issue. you meant saving the game right?
Is TeamCreate on for your game?
have you published the game and commited the scripts
have you published the game because when i publish it it puts a draft on the down-right corner which there is written that commit the scripts so they could run in the game blah blah bla…
so please try this because it happend to me also
No (30 character limit…)
originally my game wasn’t published, but it’s still having the same issues. Also, commit scripts? I’m not in team create… is their an option like that for when your not in team create?
Odd, if I were you I would try to add print("This script is running")
to scripts that aren’t running. That way, you can see if the output will show what you printed.
There’s not much context to go off of, for example, what are these scripts meant to do vs what’s not happening, what scope is it on, etc.
I have added prints before but the scripts don’t seem to run at all, but clearly are suposed to.
What scripts aren’t running, and where are the located? LocalScript
, for example, will not run in Workspace
or ServerScriptService
.
Still waiting for context.
But in the meantime, hypothetically speaking, if your scripts aren’t returning errors and delays seem to fix it, then I want to assume that you have if statements placed but the script is running once and too fast for the foreseen conditions to be met
The scripts run, just not every time. Mostly the ones with a-lot going on in them are the ones that don’t run. Most of the server scripts are in the server script service and local scripts in local player (I never load the character, so always player)
Sorry for you having to wait, the script that is mostly having the issue is the supposed to be loading land of 3 types, then clone trees if it’s grass, cars if it’s road, and logs if it’s water(I haven’t got to the last part) similar to crossy road. Though I have had issues with moving the player before, where I would have to change the CFrame of the players “character” frequently really fast. Their are alot of if statements in both of them btw.
This does sound like what’s happening, but I don’t know how I would fix it.
Could you show me what script(s) aren’t always running, I’m not an advanced programmer but I could check your code for any errors that might prevent it from running.
Depends on when you want it to run, point is, you need to have it run more than once. You can use events accordingly to when you need it or loops if it should be constant.
If it relies on the character then perhaps you should wait for it to load using the CharacterAdded
event (or something, idk, I witnessed a whole conversation regarding something about it being unreliable at the moment)
I will try that, see if it fixes the problem; but what if the code chooses to never run no matter how many times you call it?
The only scenario that I can picture that happening is if you create a loop that kills the game ;-;
I’m going to call it a day now but definitely look into events and/or loops