Oh I know that, but I want to know if it’s possible not letting other players seeing your XP while they are in the leaderboard?
then you can just set an attribute to the player using :SetAttribute(“NameOfAttribute”, value)
Ok thx! This also might help me for one of my ideas since I need to basically do the same thing as this.
If it works I’ll make it a solution
Hey @Pure_Bacn I found out that you can just make a Folder that named hidden and put it in the leaderstats folder, then everythng in that hidden folder is hidden and can’t be seen from public, but still it is in the leaderboard.
I think this can saved by the game, because it’s in the leaderstats, it just you can’t see it
In order to save it you need datastore.
heres a link to help you:
I know there’s an article that teach data storage, but now since I added the IntValue to the leaderboard, I wonder can I change through a script
yes you can you just have to do it via serverscript
OOOO thx I’ll try, also can you gimme an example script, like maybe an IntValue got changed within the server script? And also is there a way to change specific player IntValue in the script?
Well you can use an attribute so like:
game.Players.PlayerAdded:Connect(function(player)
player:SetAttribute("XP",0) --If attribute xp exists, overwrite it, if not create it with value of 0
end
I wonder is it possible to not use an attribute but have the same result as what I wanted?
- You need to pass the player your firing to remote to.
-
if game.replicatedstorage.xptrigger:FireClient()
would not work since it would return a nil value ( nothing ) because only remotefunctions and bindablefunctions return something.
I don’t know if this works since I haven’t tested it but give it a try
First, you want to add a ModuleScript in ServerScriptService called GetPlayer
Then type in this in the Module Script:
local module = {}
game.Players.PlayerAdded:Connect(function(player)
function module.GetPlayer()
return player
end
module.GetPlayer()
end)
return module
(Script inside of an enemy)
local GetPlayer = require(game:GetService("ServerScriptService").GetPlayer)
script.Parent.zombie.Died:Connect(function()
local player = module.GetPlayer()
print('It is dead!')
local CheckIfZombieDied = game.ReplicatedStorage.XPtrigger:FireClient(player)
if CheckIfZombieDied then
print('It fired!')
end
end)
(Inside of StarterPlayerScripts)
game.ReplicatedStorage.XPtrigger.OnClientEvent:Connect(function()
-- check if it received the firing event from the remote event
print('It receive!')
script.Parent.Parent.LevelsInfo.playerXP.Value += 15
return true
end)
Then use an intvalue (Instance.new(“IntValue”,player))
Oh ok, so that means of a just do a local player = game.Players.localPlayer
then add that player to the bracket inside of the FireClient()
Your quite of close, you can’t use LocalPlayer inside a serverscript.
To get the player who killed the npc/player use a creator tag.
local tag = humanoid:FindFirstChild('creator')
if tag and tag.Value then
remote:FireClient(tag.Value)
end
You can only use the died event on an Instance if its a humanoid so zombie.Humanoid.Died and FireClient assuming the script is a local script you would have to pass in the player as a parameter.
Hi guys, sorry for the 11 days that I didn’t reply. I have been looking through tutorials / free script that I can use for a base of my level system. I finally find one recently (Actually now) and I decided to use it. Since the script is using clicks for gaining XP, I will modify the script to apply for my situation. Also is it ok that your guys can give me a basic formula for my level system?