#Leaderstats access
1 messages · Page 1 of 1 (latest)
It is local script right?
If so the its game.Players.LocalPlayer
And you have to make it yourself
In a script
Im aware but I'm accessing it in a different script
You are accesing the player right? Not the character?
Yes
The one that detects the folder
wouldnt that just make a new one?
did you aquire it in the otherscript? you should be able to define it as a variable if so
I made the int value in another script wdym define as a variable
do you not know what a variable is
** You are now Level 10! **
💔
Dude I was taught Lua like 4 days ago
You want to change the Money value?
leaderstats without knowing what a variable is
variables are basically ways of organising code or like an object into 1 piece of text
for example
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
ah shitt
Do you create it at first and where
I create it in a script within server script service
Sorry if I'm just really dumb 😔
local Players = game:GetService(“Players”)
local Plr = Players.LocalPlayer
local MoneyStat = player:WaitForChild("leaderstats"):WaitForChild("Money")
🤦♂️
.touched needs to be done on the client
update the leaderstat on the server with remote events
local Players = game:GetService("Players")
local Money = Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Money")
if not Money then
print("Unable to find the Money stats in the LocalPlayer.")
end
Also this needs to be in a localscript if not already done
didn't see
waitforchild is used because it makes it so the script only runs when the leaderstat is there
sometimes if you dont it will run with nothing there so will return nil
Thank you this helps alot
It doesn’t