I think I understand that part, but I do not know where
and @Ugh_Lily What is that?
I think I understand that part, but I do not know where
and @Ugh_Lily What is that?
A plugin to help you organize your code. It’ll format the code for you automatically.
https://gfycat.com/GoodnaturedCommonAndeancondor
perhaps there is a bracket missing.
I only counted five so the statement is not concise.
Where do you get it to fix the scripts, it is not doing it on my end. I can’t find that screen that you have.
That means you have an error. Open up Script Analysis for me.
Can you send the link for me… Thanks!
Usually just look for the red underline to begin with. That typically highlights your source of error; in this case, placing an else statement outside of an if statement and ending another scope too early. I also see a few bad practices in your code.
Your IDE should automatically complete some scopes and statements, as well as indent your code for you, so make sure to use that to your advantage to determine where to place code.
The right questions weren’t being asked which may have been part of the reason why this thread got so bloated.
I can provide a fix for you, but a forewarning that I’m on mobile so it’s not complete code.
-- Good practice to index services first
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
-- Next your variables*
local MoneyData = DataStoreService:GetDataStore("MoneyDataStore")
local DefaultCash = 100
--* In the future, you'll want to save all player data in one DataStore or so.
-- Instead of a DataStore for money, make one for data. Save a table to that DataStore with money as an entry.
Players.PlayerAdded:Connect(function (Player)
-- Create leaderstats and money value like in your original code
Player.CharacterAdded:Connect(Character)
-- Status and tag destroy here
end) -- Do not call LoadCharacter unless CharacterAutoLoads is false; set RespawnDelay to 0 instead
local success, data = pcall(MoneyData.GetAsync, MoneyData, player.UserId)
if success then
if data then
-- Set value of money
else
-- Set value of money to default
end
else
-- Call errored, handle DataStore error
end
end)
That should be about it.
I think i got that sorted out already, thanks for the help though!
Ok, I have it open, what should I do now?
If your issue is sorted out, then you should mark the post that resolved it as the solution and start a new thread if you have a different matter to attend to, since this is getting off-topic.
Just a self-insert here that I think my post is pretty worthy of that check mark.
Not the whole issue is resolved.
What issues are currently remaining? Let’s get back on track here and help you tackle all the issues you still have remaining.
The above plugin, Beautify, is slightly off-topic. You should continue that conversation in a DM. (cc @Ugh_Lily)
The second issue is remain. Look at the bottom, or look through this convo.
I addressed the circumstance of that code in my initial response to this thread.
It should look something like this:
if not character or (character and character:FindFirstChild("Humanoid") and character.Humanoid.Health == 0) then
table.remove(plrs, x) -- Not sure where either of these variables are derived from, since that's not included
-- Your other code
end
not
negates an operand. == checks if a value is equal to something. If you read it literally, it’s like = (is) = (equal to).
Now it says," expected eof, got else.
Would you be able to provide the snippet of code you’re working with where this issue is occurring? Truncate the parts that are irrelevant. The code I provided doesn’t have any errors, so they must be stemming from another piece of code.
This is probably something you can diagnose yourself though by checking where you’re putting your scope statements and heeding warnings in the console.
The code keeps saying as I said. Idk what to do.
Can I just add someone to my team create?
The console/script analysis windows will give you a line number to where the error is located. Double-clicking the error will also take you to it.
You are probably missing an “end” somewhere.