Hello. I’m developing a game where you claim a store and sell clothing you made.
Each store has this script:
local store = script.Parent.Parent.Parent
local rentsign = store.ForRentSign
local storeinfo = game.DataStoreService:GetDataStore("StoreInfo")
script.Parent.Triggered:Connect(function(player)
local owned = player:FindFirstChildWhichIsA("ObjectValue")
if owned then
if owned.Value == nil then
local success, error = pcall(function()
owned.Value = store
store.Owner.Value = player.UserId
local data = storeinfo:GetAsync(player.UserId.."_StoreInfo")
if data then
wait()
elseif not data then
local newdata = {
255,
255,
255,
player.Name.."'s Store"
}
store.Text = newdata[4]
local r = newdata[1]
local g = newdata[2]
local b = newdata[3]
for i, paintable in pairs(store.Paintable:GetChildren()) do
wait()
if paintable:IsA("Part") then
paintable.Color = Color3.fromRGB(r,g,b)
end
end
store.Text.SurfaceGui.TextLabel.Text = newdata[4]
end
game.ReplicatedStorage.Notify:FireClient(player, "Claimed!", 2)
end)
if not success then
game.ReplicatedStorage.Notify:FireClient(player, "Failed to claim store!", 2)
warn("Failed to claim store : "..error)
end
else
game.ReplicatedStorage.Notify:FireClient(player, "You own a store already!", 2)
end
end
end)
game.Players.PlayerRemoving:Connect(function(removing)
end)
However, when I trigger the proximity prompt, it just prints this:
But the Text part is a valid member of the Store Model:
I also tried to print out the Text part and it also failed.
Do you know why this is happening?