I have a guibutton that when clicked, clones and welds a part based on a value within the button. However this doesn't work because the Remote Event that is fired when the button is clicked can't access the players GUI. I read on the Wiki that information can be passed with remote events. How would I do this? Hopefully I didn't word this too terribly and someone has an idea. Thanks in advance for any aid!
--The LocalScript-- local player = game:GetService("Players").LocalPlayer script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.SelectedTrim.Value = script.Parent.Haircut.Value -- The value the event normally uses. player.Character.PlayerData.AttireData.OutfitHelmet.Value = (script.Parent.Haircut.Value) local e = game.ReplicatedStorage:WaitForChild("HaircutEvent") e:FireServer() end)
--The ServerScript-- function DescendList(player) local DataLoad = player.Character:WaitForChild("PlayerData") local WD = DataLoad.WeldingAids:FindFirstChild("WeldData") local Weldee = DataLoad.WeldingAids.Weldee local Hat = player.Character.PlayerEquipment.FakeHeadComponents Hat:Destroy() local Helm = DataLoad.AttireData.OutfitHelmet local T = DataLoad.CharCustomData.HairStyle -- The value that I'm now using that I want to match the value of the button clicked. Helm.Value = T.Value Weldee.Value = Helm.Value WD.Value = ("FakeHead") PerformWeld(player) print("Trimmed") end local event = game.ReplicatedStorage:WaitForChild("HaircutEvent") -- make sure the event in in ReplicatedStorage event.OnServerEvent:connect(function(player) -- OnServerEvent automatically passes the player who fired it as the first argument. DescendList(player) end)