Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script to refresh Stat value won't work right?

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>

1 comment

0

it doesnt show error anymore but doesnt refresh strength value

1 answer

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

2 comments

0

Oh yeah thats right

0

ok

This discussion is preserved as it was. New answers, comments, and votes are closed.