Hey, I am having trouble displaying a value located in the "workspace.Charactername" area. The following is what I have in a Local script that is within a text label.
local Clothingvlu = game.Players.LocalPlayer.Character.Clothing local mode = "Bleh"--ignore script.Parent.Text = "" ..Clothingvlu.Value.. " (P) of clothing."
When I run this I get the following error:
16:17:39.990 - Clothing is not a valid member of Model
16:17:39.991 - Script 'Players.Player.PlayerGui.TradeSystemGUI.ClothingAmount.Loca', Line 1
16:17:39.992 - Stack End
This is especially confusing because I can use this other script with no trouble at all: (Its not a local script)
function onButtonClicked() --This gets the player who clicked and changes a value within the player local h = script.Parent.Parent.Parent.Parent.Character.Clothing h.Value = 101 print (h.Value) end script.Parent.MouseButton1Click:connect(onButtonClicked)
Help appreciated
Assuming the first script is in their PlayerGui, the PlayerGui tends to load before the actual character. Use the WaitForChild method to well, wait for the child.
local Clothingvlu = game.Players.LocalPlayer.Character:WaitForChild('Clothing') local mode = "Bleh"--ignore script.Parent.Text = Clothingvlu.Value.. " (P) of clothing."
Another way is by adding a wait()
repeat wait() until game.Players.LocalPlayer.Character local Clothingvlu = game.Players.LocalPlayer.Character local mode = "Bleh"--ignore script.Parent.Text = Clothingvlu.Value.. " (P) of clothing."