Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script to refresh Stat value won't work right?

Asked by
Xayzen 2
4 years ago
Edited 4 years ago
local button = script.Parent
local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait(2)
local strength = player.Stats.Strength.Value
local str = player.Stats.Strength
button.Text = strength
local function onChanged()
a = str:GetPropertyChangedSignal("Value"):Connect(onChanged)
if a then
print("fired")
button.Text = strength
end

How could I get it to refresh the Strength.Value to the new value without having to respawn the character?

error code

 Players.Xayzen.PlayerGui.ScreenGui.Frame.STRVALUE.LocalScript:12: Expected 'end' (to close 'function' at line 7), got <eof>
0
it doesnt show error anymore but doesnt refresh strength value Xayzen 2 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

heyyy u forget the end at the if statement rbrrxzzzz

local button = script.Parent
local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait(2)
local strength = player.Stats.Strength.Value
local str = player.Stats.Strength
button.Text = strength
local function onChanged()
    a = str:GetPropertyChangedSignal("Value"):Connect(onChanged)
        if a then
        print("fired")
        button.Text = strength
    end
end
0
Oh yeah thats right Xayzen 2 — 4y
0
ok Friskyman321 121 — 4y
Ad

Answer this question