#TextLabel Does not want to Update
1 messages · Page 1 of 1 (latest)
my bad i was waiting for response
so here is my code
local player = game.Players.LocalPlayer
local Button = script.Parent
local Mouse = player:GetMouse()
local Rep = game:GetService("ReplicatedStorage")
local Event = Rep:FindFirstChild("TelPortEvent")
local Sound = Button.Goku
local BodyScreen = player.PlayerGui:FindFirstChild("BodyScreen")
local EnergyFrame = BodyScreen:FindFirstChild("EnergyFrame")
Button.MouseButton1Click:Connect(function()
if Button.Text == "TelePort" then
Button.Text = "Stop"
wait(0.1)
Mouse.Button1Down:Connect(function()
if Mouse.Target and Mouse.Target:IsA("BasePart") then
local hit = Mouse.Hit.Position
local Value = tonumber(EnergyFrame.MinNum.Text)
print("Current Energy Value: " .. tostring(Value))
if Value then
Sound:Play()
Value = Value - 100
if Value < 0 then
Value = 0
end
EnergyFrame.MinNum.Text = tostring(Value)
print("Updated Energy Value: " .. tostring(Value))
Event:FireServer(hit)
else
warn("Invalid value in MinNum text!")
end
end
end)
elseif Button.Text == "Stop" then
Button.Text = "TelePort"
end
end)
but the EnergyFrame.MinNum.Text = tostring(Value)
i does not want to Update as wanted
I'm not 100% sure I understand.
Is it setting it to something you don't want? Is it not setting it at all?
Button.MouseButton1Click:Connect(function()
if Button.Text == "TelePort" then
Button.Text = "Stop"
wait(0.1)
Mouse.Button1Down:Connect(function()```
that's not how events work, you are connecting to mouse.button1down every time the textbutton is clicked. events are not conditions, they are not magic waits, they are events. they run when the event happens, not when you connect it.
but it works fine tho the problem is that EnergyFrame.MinNum.Text = tostring(Value) -- the MinNum which is a TextLabel does not want to update to that why is that
yes everything works fine but my TextLabel(MinNum) it does not Update and change
"the code is fine and everything is working its just not working" ... well i'm not sure what else to tell you if your code is fine and everything works 🤷
well this
the TextLabel(MinNum
so when the Button is Pressed
then the mouse should activate and whenever the player clicks somewhere he should Teleport to it
which works perfect
but while he Teleport it will Cost him an Energy which is -100
and The TextLabel (MinNum) its text is right now 200 it should be able to decrease when the Mouse is Pressed and everything works fine it also prints everything that needs to be printed and it does print that it changed but when i look at the TextLabel i still see the same number which is 200
while it should be decreased to 100
i suspect you're changing it on both the server and client
coz if its getting to this Event:FireServer(hit) then i would expect everything else to be fine, aside from the already mentioned connecting events multiple times
the event only fires the position so i can change the players position in the server so every other player can see the player changing position
could also be the path is wrong, duplicates with the same name, etc
wait let me check rq
@languid smelt so i think i found the proble
its my guis that are broken is what i think
when playing the game i runned this command: game.Players.LocalPlayer.PlayerGui.BodyScreen.EnergyFrame.MinNum.Text = "100"
and the Text did not want to change at all and i get no errors or anything
yep so look through those folders in explorer and see if everything is in the right place
pretty close 
Can you maybe help its a big script and i have no idea where im going wrong with this one
i dont do that kind of thing without payment. small help threads are fine on occasion but i aint doing your whole project for you
oh ok no problem but thanks for the help tho
you're still connecting the event multiple times though, each time the textbutton is pressed
but dw i'm sure you'll figure that out sooner or later ;p
yea your right i can see what you mean
i will change that