Well, I'm really new whit roblox studio (not more than a few week), and now i have my first hard problem: For testing my knowledge, I wanted to try to make a simulator-kind game, I made an UI and I scripted a few "power" (in-game value; you can earn it jumping), but whit this "power" i started having some troubles, even if i was able to make a leaderboard money, and an uptading UI, I've seen that if i change the "power value" while I'm in-game trought explorer (the intvalue),the shop's money indicator UI do not change.
The first code i'll write here is gonna be the UI local script.
local Player = game:GetService("Players").LocalPlayer
local PlayerName = Player.Name
local power = Player.leaderstats.PlayerPower.Value
local UserInputService = game:GetService("UserInputService")
local function onInputEnded(inputObject, gameProcessedEvent)
if gameProcessedEvent then return end
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
if inputObject.KeyCode.Name == "Space" then
wait(0.1)
power = power + 1
Player.leaderstats.PlayerPower.Value = power
script.Parent.Text = power
end
end
end
UserInputService.InputBegan:Connect(onInputEnded)
The second one the money script itself.
power = "Power"
starterPower = 0
game.Players.PlayerAdded:connect(function(plr)
local fold = Instance.new("Folder", plr)
fold.Name = "leaderstats"
val = Instance.new("IntValue", fold)
val.Name = "Power"
val.Value = starterPower
end)

1 comment
The problem is its in a local script. If I were you, I'd use a remote event that fires when the space bar is pressed, and then connect that remote event with a regular script stating that when the remote event fires, it will add +1 to your value. The local script only shows for you, not for everyeone.