#Can't apply string to TextLable

1 messages · Page 1 of 1 (latest)

feral rover
#

I want for dataStore.Value.Wood to be put in a TextLable but it just doesn't work for no reason even though print(dataStore.Value.Wood) works perfectly fine and prints out the value it needs to.
-# Sorry if that all sounds stupid I just started coding like a week ago so I don't know much ;-;

local DataStoreModule = require(game.ServerStorage.DataStore)
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")

script.Parent.Triggered:Connect(function(player) 
    local dataStore = DataStoreModule.find("Player", player.UserId)
    game.StarterGui.InventoryGui.Frame.ResourceCount.Wood.Text = tostring(dataStore.Value.Wood)
    if dataStore == nil then return end
    if dataStore.State ~= true then return end
    dataStore.Value.Wood += 1
    print(dataStore.Value.Wood)
    game.StarterGui.InventoryGui.Frame.ResourceCount.Wood.Text = tostring(dataStore.Value.Wood)  --This Line
end) ```
quiet dome
#
print(dataStore.Value.Wood)
#

what does this block print?

#

@feral rover

feral rover
quiet dome
#

oops

#

nvm

#

so

feral rover
#

nope, no errors. But the Text Lables dont update ;-;

#

oh okay what

#

uhm em nope

quiet dome
#

alr

#

so

#

mbmb

#

what you have to do is

#

you're updating

#

the startergui

#

not what players seeing

#

so when the game starts

#

startergui clones

#

into the players screen

#

so you have to do

#

Player.PlayerGui

#

instead of

#

game.StarterGui

feral rover
#

hmmmmm uhh

quiet dome
#
local DataStoreModule = require(game.ServerStorage.DataStore)
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")

script.Parent.Triggered:Connect(function(player) 
    local dataStore = DataStoreModule.find("Player", player.UserId)
    player.PlayerGui.InventoryGui.Frame.ResourceCount.Wood.Text = tostring(dataStore.Value.Wood)
    if dataStore == nil then return end
    if dataStore.State ~= true then return end
    dataStore.Value.Wood += 1
    print(dataStore.Value.Wood)
    player.PlayerGui.InventoryGui.Frame.ResourceCount.Wood.Text = tostring(dataStore.Value.Wood)
end)
#

here you go

#

sorry for the shitty

#

explaining 😭

feral rover
#

aaaaahh ;-;

#

Okay I see I see

#

I understood what was needed to be done just wasnt sure how waaaa

quiet dome
#

is it working now?

feral rover
#

YESS

tiny relicBOT
#

studio** You are now Level 1! **studio

feral rover
#

yepieee

#

Thanks so much O:

quiet dome
#

great

#

yw