So, i know that local scripts only affect the client. But i don't know what should i do so the change affects the server as well. Some people told me to use remote events, I do know how remote events work but i honestly have no idea how to change the gui via a remote event. Here's the local script:
local PetName = script.Parent.Name local PAW = require(game.ReplicatedStorage.Modules.PAW) local CoinWorth = PAW[PetName][1] local GemWorth = PAW[PetName][2] local CurrencyMulti = PAW[PetName][3] local HatchSpeed = PAW[PetName][4] local PetImageID = PAW[PetName][5] local PetLabel = script.Parent.Parent.Parent.Parent.Parent.InventoryLabel.PetExample local PetIcon = PetLabel.PetIcon local PetLabelName = PetLabel.PetName local Multiplier = PetLabel.CoinMulti local HatchSpeed2 = PetLabel.HatchMulti local PetAmount = script.Parent.PetAmount local PetAmountLabel = PetLabel.PetAmount local function PickPet() if game.Players.LocalPlayer.PetsOwned[PetName].Value == true then PetLabelName.Text = PetName Multiplier.Text = (CurrencyMulti.."x") HatchSpeed2.Text = (HatchSpeed.."x") PetIcon.Image = PetImageID PetAmountLabel.Text = PetAmount.Text else print("You do not have this pet!") end end script.Parent.MouseButton1Click:Connect(PickPet)
Could appreciate any help!
script
local rf = Instance.new("RemoteFunction",game.Workspace) rf.Name = "rf"
again script
game.Workspace:WaitForChild("rf").OnServerInvoke = function(plr, txt) for i,v in pairs(game.Players:GetPlayers()) do v.PlayerGui."your gui here(without quotes)"."Your label".Text = txt end end
LocalScript
game.Workspace:WaitForChild("rf"):InvokeServer("your text here(with quotes)")