Just began working with ProximityPrompt’s a couple days ago and they seem relatively simple. However, when trying to change the properties ObjectText and ActionText, it seems to only work once.
NOTE: This is a shop that is duplicated on all clients - and these properties are trying to be changed on only the client, not for the rest of the server.
Code
function UpdateTag(pet)
local PetFolder = Pet_Shop:FindFirstChild("Pets")
local Pet = PetFolder:FindFirstChild(pet)
print(pet)
if Pet then
local EquipButton = Pet:FindFirstChild("Table"):FindFirstChild("Nameplate"):WaitForChild("Equip")
print(EquipButton:GetFullName(), EquipButton.ActionText, EquipButton.ObjectText)
if Equip_Button then
Equip_Button.ActionText = "EQUIP"
Equip_Button.ObjectText = Pet.Name
print(EquipButton.ActionText, EquipButton.ObjectText)
wait(5)
print(EquipButton.ActionText, EquipButton.ObjectText)
end
end
end
I’ve used essentially the same line of code earlier in the script and it worked flawlessly.
Here’s the previous used code where it worked just fine.
Previous Working Code
local function UpdateShopFromData(result, pet)
local Pets_Folder = Pet_Shop:FindFirstChild("Pets")
local Pet = Pets_Folder:FindFirstChild(tostring(pet))
local Button = Equip_Button:Clone()
local Nameplate = Pet:FindFirstChild("Table"):FindFirstChild("Nameplate")
local cost = Pet:FindFirstChild("Info_Folder"):FindFirstChild("Cost").Value
Button.Parent = Nameplate
if result == true then
Button.ActionText = "EQUIP"
Button.ObjectText = Pet.Name
elseif result == false then
Button.ActionText = "UNLOCK"
Button.ObjectText = "Cost ".. cost.. " Treats!"
elseif result == "lastEquippedPet" then
Button.ActionText = "EQUIPPED"
Button.ObjectText = Pet.Name
end
end
Any idea why it had worked above, yet no longer worked below?
Here’s my output to show what print’s are printing.
Output - spoiler, it all prints out fine.
16:00:22.184 220 - Server - Pet Shop:37
16:00:22.184 5 - Server - Pet Shop:38
16:00:22.269 Monkey - Client - Pet_Shop:109
16:00:22.269 Workspace.Client_Pet_Shop.Pets.Monkey.Table.Nameplate.Equip UNLOCK Cost 5 Treats! - Client - Pet_Shop:112
16:00:22.269 UNLOCK Cost 5 Treats! - Client - Pet_Shop:116
16:00:27.285 UNLOCK Cost 5 Treats! - Client - Pet_Shop:118
As you can see, all variables are correct and printing. However the text just isn’t changing.
Any ideas or suggestions?