At moment:
Not sure if any of these 3 scripts are needed
Not sure if any of these 3 scripts are needed
Not sure if any of these 3 scripts are needed
This is script when touch part it should add plus 1
At moment:
Not sure if any of these 3 scripts are needed
Try doing instead of Coins.Value =+ 1
do Coins.value = Coins.value + 1
See if that works.
Also, your leader stats are erroring, which is probably why it isn’t working as well. Mind if you say what the errors are?
You can try doing a local script in the gui that says:
local plr = game.Players.LocalPlayer
plr:WaitForChild("leaderstats"):WaitForChild("Coins").Changed:Connect(function(val)
script.Parent.Text == val
end)
Then if the part touched server script isn’t working you could do:
local players = game:GetService("Players")
script.Parent.Touched:Connect(function(hitPart)
local char = hitPart:FindFirstAncestorOfClass("Model")
if char then
if char:FindFirstChildOfClass("Humanoid") then
local plr = players:GetPlayerFromCharacter(char)
plr:WaitForChild("leaderstats"):WaitForChild("Coins").Value += 1
end
end
end)
Also I don’t know if I can’t read and this was addressed but there’s an infinite yield on “Coins” in leaderstats, are you sure it’s parented to leaderstats? In the second script where you create “Coins” leaderstats is undefined.
FYI: No difference. It does the same thing and it’s shorter to do += 1, *= 1
and so on.
I know, I just personally think it’s easier to understand so I recommend changing it. We all have different ways of operators.
Ye im really not sure whats wrong…
You should remove the first script. The one at the top of this topic.
Basically there are 3 scripts all making leaderstats folders. The coin script may not find the correct leaderstats folder and not add it to the coin amount. In fact, only keep the third script (the lowest in ServerScriptService) and rename it to something so you can understand what it does.
That has nothing to do with your leadertats. At the right you can see it’s an error on the CLIENT. It’s also not finding “SendClientPetData” which I think is a remoteEvent in ReplicatedStorage. You probably removed a script that constructs a remote event or remote function. You should delete the 2 scripts that are at the top in this topic, not just the random order that they are in in ServerScriptService.
Ok! If i change it to something i want, do i need to change anything in the script?
What do you mean exactly? 30charlimit
You said i should change the script name in server script service to something i can remember. Do i need to change it in a script so a script can recognise it?
the quotes for making the int coin in the leaderstats script are the wrong type of quotes, use the same ones that it uses to make the folder instance
No, it’s not for recognising inside other scripts. Just to make it easier to understand what the script is.
Leaderstats/coin variable is what i have called it.
The name of the script right? Not the variables inside the script, I’m talking about the name of it.
Leaderstats/coin variable is the name of the script inside server script service.
Ok you should only keep the ServerScriptService script that you posted an image about above the sentence “This is script when touch part it should add plus 1” (Keep any scripts that weren’t posted as images and also keep the Coin increment script) And also replace those quote marks to " as TheBaconHero_101 said.