-
What do you want to achieve? Keep it simple and clear!
I am making a new game with my group and well we have this bug that when we see the leaderstats It doesn’t change you can only see how much you have and you can see it changing but others will not see. -
What is the issue? Include screenshots / videos if possible!
https://gyazo.com/a60dd35c4bdfecfffaa73b6b1a17e9e8
I had 99.9M clicks but they don’t see it.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?I have tried the :GetPropertyChangedSignal to show the change
If you change the value on the client, other players won’t see it. Use a RemoteEvent to tell the server when you click.
There are 2 problem that I suspect.
- Since you have a like 100M it won’t show the 100’s digits
- You are changing the Value locally not Globally (User Remote Events or functions)
Since you are firing an event from the client to the server you would use:
game.ReplicatedStorage.YourEventNameHere:FireServer()
To receive the event on the server and connect it, you would use:
game.ReplicatedStorage.YourEventNameHere.OnServerEvent:Connect(function(player)
-- logic to add values to leaderstats
--[[
Example:
player.leaderstats.Clicks.Value += 1
]]
end)
Let me know if you have any questions.
That doesn’t work It doesn’t make a leaderstats
Look back to my previous post. I made an edit to show you an example of how you would add to the click value. You already have the leaderstats made. This is just to update the Clicks value on the server.
First of all, if you are changing the value from client. Then you shouldn’t do that.
Use RemoteEvent or ServerScriptService directly.
RemoteEvent Usage:
-First create and RemoteEvent class object and put it into ReplicatedStorage then create an client script that fires it when you want to change it.
To fire it: game.ReplicatedStorage.RemoteEvent:FireServer(ValueToAdd)
-Create a server script into ServerScriptService then type a code that listens the event when it fired.
To listen: game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(sendedValueToAdd)...
Then you can type your code into this function. That’s it.
ServerScriptService Usage:
First define a conition to make script work. Example, when player touched a coin part, value will increase.
Example script:
for _, part in pairs(workspace.Coins:GetDescendants()) do
if game:GetService("CollectionService"):HasTag(part, "Coin") then
part.Touched:Connect(function(touchedPart)
if game.Players:GetPlayerFromCharacter(touchedPart.Parent) then
local player = game.Players:GetPlayerFromCharacter(touchedPart.Parent)
part:Destroy()
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + addedCoinPoints
end
end)
end
end
I hope you can solve the problem.
Could you send us your script?
could you send me the script in text and indent it? because I don’t see any thing wrong here. Also can you send me the script where you increase the Value?