I’m making a system where the user can get an image from roblox, insert the link into a text box, then a decals texture ingame will change to that image. For some reason it’s not working, or erroring, here’s the code:
Server:
local repStor = game:GetService("ReplicatedStorage")
local changeBoothInfo = repStor:WaitForChild("ChangeBoothInfo")
local booths = workspace:WaitForChild("Booths")
local players = game:GetService("Players")
local TextService = game:GetService("TextService")
local filteredText
changeBoothInfo.OnServerEvent:Connect(function(player, textType, inputText)
local success, err = pcall(function()
local filtered = TextService:FilterStringAsync(inputText, player.UserId)
filteredText = filtered:GetNonChatStringForBroadcastAsync()
end)
if textType == "BoothText" then
for _, v in pairs(workspace.Booths:GetChildren()) do
if v.OwnerValue.Value == player.Name then
v.Text.Gui.Text.Text = filteredText
end
end
elseif textType == "TopImage" then
for i, v in pairs(workspace.Booths:GetChildren()) do
if v.OwnerValue.Value == player.Name then
v.ImageOne.Decal.Texture = inputText
end
end
elseif textType == "SideImage" then
for i, v in pairs(workspace.Booths:GetChildren()) do
if v.OwnerValue.Value == player.Name then
v.DecalTwo.Decal.Texture = inputText
end
end
end
end)
Client:
local player = game:GetService("Players").LocalPlayer
local repStor = game:GetService("ReplicatedStorage")
local playerGui = player:WaitForChild("PlayerGui")
local boothClaimed = repStor:WaitForChild("BoothClaimed")
local openEdit = playerGui:WaitForChild("EditBooth"):WaitForChild("OpenEdit")
local editFrame = playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame")
local submitBoothTextButton = editFrame:WaitForChild("SubmitBoothText")
local submitSideImageButton = editFrame:WaitForChild("SubmitSideImage")
local submitTopImageButton = editFrame:WaitForChild("SubmitTopImage")
local boothTextInput = editFrame:WaitForChild("BoothTextInput")
local topImageID = editFrame:WaitForChild("TopImageID")
local sideImageID = editFrame:WaitForChild("SideImageInput")
boothClaimed.OnClientEvent:Connect(function()
for i = 1, 20 do
openEdit.TextTransparency -= 0.05
openEdit.BackgroundTransparency -= 0.05
task.wait(0.05)
end
end)
openEdit.MouseButton1Click:Connect(function()
playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame").Visible = not playerGui:WaitForChild("EditBooth"):WaitForChild("EditFrame").Visible
end)
submitBoothTextButton.MouseButton1Click:Connect(function()
local userInputText = boothTextInput.Text
repStor.ChangeBoothInfo:FireServer("BoothText", userInputText)
end)
submitSideImageButton.MouseButton1Click:Connect(function()
local userInputText = sideImageID.Text
repStor.ChangeBoothInfo:FireServer("SideImage", userInputText)
end)
submitTopImageButton.MouseButton1Click:Connect(function()
local userInputText = topImageID.Text
repStor.ChangeBoothInfo:FireServer("TopImage", userInputText)
end)