The variable I am talking about is called "object" The problem with it is that the variable is only able to be defined in the local script.
Here is the code for the local script:
local player = game.Players.LocalPlayer local BPK = player:WaitForChild("BPK") local object = BPK:FindFirstChild(script.Parent.Parent) script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.ChangeInfoGui:FireServer(object) end)
Here is the code from the server script:
game.ReplicatedStorage.ChangeInfoGui.OnServerEvent:Connect(function(player, object) local info = player.PlayerGui.Back.Info local BPK = player:WaitForChild("BPK") info.Transparency = 0 info.ObjDesc.Transparency = 0 info.ObjName.Transparency = 0 info.ObjName.Text = object.Name info.ObjDesc.Text = object.Description.Value end)
I was doing it correctly I just changed the code to this (on the local script):
local player = game.Players.LocalPlayer local BPK = player:WaitForChild("BPK") local name = script.Parent.Parent.Name local object = BPK:FindFirstChild(name) print(object) script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.ChangeInfoGui:FireServer(object) end)