1

# Why leaderstats don't apear?

Asked by 21 days ago

I try make a clicker game and I finded a tutorial on youtube but I cannot make leaderstats work.Here's the script I finded: local event = Instance.new("RemoteEvent") event.Name = "AddStats" event.parent = game.ReplicatedStorage

event.OnServerEvent:Connect(function(plr) local taps = plr.leaderstats.Taps taps.Value = taps.Value + 1 end)

game.Players.PlayerAdded:Connect(funtion(plr) local ls = Instance.new("Folder") ls.Name = "leaderstats" local menu = Instance.new ("IntValue", ls) menu.Name = "Taps" ls.Parent = plr end)

Can someone try find the problem pls?

0
Xapelize 1459
21 days ago

Make sure you put this script on ServerScriptService.

game:GetService("Players").PlayerAdded:Connect(funtion(player)
local leaderstats = Instance.new("Folder", player)

end)


Don't put 2 different function in the same script, it's harder to find them. You should split the script 2 parts. So heres the another part.

Also, a note, you don't need to use RemoteEvent on the same script. RemoteEvent is used for sending information between server and client (yourself). Even you need to send them between scripts, you still can access the ClickDetector in one script. No RemoteEvent are needed.

What you are gonna do in the another script. Make this as a script and put it in ServerScriptService as well.

game:GetService("Players").PlayerAdded:Connect(function(player)
wait()
local ClickDetector = game.Workspace.Part.ClickDetector

ClickDetector.MouseClick:Connect(function()
end)
end)

0
MattVSNNL 187
21 days ago

Try this code out buddy!

Put this code in a script from serverscriptservice

game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.new(¨Folder¨)

local taps = Instance.new(¨IntValue¨)
taps.Name = ¨Taps¨
taps.Value = 0