How would you go about changing Leaderstats Values in FE?
Asked by
7 years ago Edited 7 years ago
I am working on a shop gui, and everything works except the stats dont actually change, and it shows it just for the player.
This is what i got so far:
The layout is like this:
Button > Server Script, Local Script, and Remote Event (They are all inside the button)
Local Script:
01 | local BuyEventOn = script.Parent:WaitForChild( "BuyEvent" ) |
03 | local Player = game.Players.LocalPlayer |
04 | script.Parent.MouseButton 1 Down:Connect( function (click) |
06 | if Player:WaitForChild( "leaderstats" ):FindFirstChild( "Money" ).Value > = script.Parent:WaitForChild( "Cost" ).Value and Player:FindFirstChild(script.Parent.Name).Value = = 0 then |
08 | BuyEventOn:FireServer() |
Server Script:
01 | local BuyEventOn = script.Parent:WaitForChild( "BuyEvent" ) |
03 | local function BuyEvent 1 (Player) |
06 | Player:WaitForChild( "leaderstats" ):FindFirstChild( "Money" ).Value = Player:WaitForChild( "leaderstats" ):FindFirstChild( "Money" ).Value - script.Parent:WaitForChild( "Cost" ).Value |
08 | Player:FindFirstChild(script.Parent.Name).Value = 1 |
09 | script.Parent.BackgroundColor 3 = Color 3. new( 0 , 255 , 0 ) |
11 | BuyEventOn.OnServerEvent:Connect(BuyEvent 1 ) |
But what im wondering is how i would change the values to be compatible with fe. If you can help then please do! Thanks!