I’m trying to make a GUI, where you can put in a decal ID and it would update the decal’s ID on a part.
I have a LocalScript in the GUI that gets the input from a TextBox, puts the input to a StringValue in ReplicatedStorage and fires a RemoteEvent that would take the decal ID from the StringValue and change the decal ID of the part’s decal.
I am obviously doing something wrong and that is probably because the LocalScript only updates for the client using the GUI and not for the server side script.
I didn’t find any solutions anywhere for this exact issue and thought this would be the place to ask.
I am quite the beginner when it comes to scripting so I don’t really know what I am doing so some help would be appreciated!
script.Parent.MainFrame.Update.MouseButton1Click:Connect(function()
local input = script.Parent.MainFrame.Input.Text
local value = game.ReplicatedStorage.DecalValue
value.Value = input
wait(1)
game.ReplicatedStorage.DecalChange:FireServer()
end)
This is the script in ServerScriptService
game.ReplicatedStorage.DecalChange.OnServerEvent:Connect(function()
local model = workspace.ScreenProject
local decalvalue = game.ReplicatedStorage.DecalValue
local screenOne = model.SC1
local screenTwo = model.SC2
local customimage = "rbxassetid://" ..decalvalue.Value
wait(1)
screenOne.Decal.Texture = customimage
screenTwo.Decal.Texture = customimage
end)
You’re changing the value in ReplicatedStorage locally, which means the server cannot see the change. You can :FireServer() with parameters instead of changing the value inside of ReplicatedStorage like so: