RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"this doesnt work as a client script please help"
The script you provided seems to be trying to change the image of a Decal based on user input into a TextBox. If this is not working as a LocalScript, it could be due to filtering enabled which prevents LocalScripts from making changes to the Workspace. However, you can use a RemoteEvent to communicate between the client and the server. First, create a RemoteEvent in ServerScriptService and name it "ChangeDecalEvent". ServerScript: ```lua local ChangeDecalEvent = game:GetService("ReplicatedStorage"):WaitForChild("ChangeDecalEvent") ChangeDecalEvent.OnServerEvent:Connect(function(player, userInput) local imageLabel = game.Workspace.DecalFlag local validInput = userInput:gsub("%D", "") if userInput == validInput and userInput ~= "" then local success, message = pcall(function() imageLabel.Image = "rbxassetid://"..userInput end) if not success then ChangeDecalEvent:FireClient(player, "Failed to load image: "..message) end else ChangeDecalEvent:FireClient(player, "Invalid input. Numbers accepted.") end end) ``` LocalScript: ```lua local textBox = script.Parent local ChangeDecalEvent = game:GetService("ReplicatedStorage"):WaitForChild("ChangeDecalEvent") textBox.FocusLost:Connect(function() local userInput = textBox.Text ChangeDecalEvent:FireServer(userInput) end) ChangeDecalEvent.OnClientEvent:Connect(function(message) textBox.Text = message end) ``` In this setup, the LocalScript sends the user input to the server script using the RemoteEvent. The server script then tries to change the image of the Decal and sends a message back to the client to update the TextBox with the result.