I have this script:
local playerthumb = "https://www.roblox.com/headshot-thumbnail/image?userId=%s&width=420&height=420&format=png" script.Parent.DialogChoiceSelected:Connect(function(plr, choice) print(choice.Name) if choice.Name == "GetOffice" then local room = findRoom(plr) if room then local card = game.Lighting.keyTemplate:Clone() card.Parent = plr.Backpack card.Name = ("[ %s ]"):format(room.Name) card = card.Handle local front = card.front local back = card.back front.Frame.BackgroundColor3 = BrickColor.Red().Color front.thumb.Image = playerthumb:format(plr.UserId) front.name.Text = plr.Name front.rank.Text = "Owner" wait(0.25) game.Chat:Chat(script.Parent.Parent, "Your office is #" .. room.Name:sub(7), Enum.ChatColor.Green) else wait(0.25) game.Chat:Chat(script.Parent.Parent, "Sorry, I cant find a room for you right now", Enum.ChatColor.Red) end elseif choice.Name == "VisitOffice" then local card = game.Lighting.keyTemplate:Clone() card.Parent = plr.Backpack card.Name = "Visitor Car" card = card.Handle local front = card.front local back = card.back front.Frame.BackgroundColor3 = BrickColor.Green().Color front.thumb.Image = playerthumb:format(plr.UserId) front.name.Text = plr.Name front.rank.Text = "Visitor" else game.Chat:Chat(script.Parent.Parent, "Come back anytime!", Enum.ChatColor.Blue) end warn("done") end)
And it works in studio, but not in regular servers.
EDIT: The script's parent is a Dialog with two DialogChoices
EDIT2: Cut down script length
FilteringEnabled = true
and
StreamingEnabled = false