Hi! I have a little issue here. I am using an ObjectValue(through a local script) to determine what template(a frame) is selected.
When I click a button and send the ObjectValue.Value through remote event, in serverside, it says that the Value is nil. Still, I’m using a remote event so even if the objectvalue.Value is locally set, it shouldn’t be nil in server. Hope you can help me!
The “Dog” is the Value of the objectvalue locally, “Fired” is to make sure and “nil” is the value of the objectvalue serverside.
The PetTemplate is the value of the ObjectValue and you can see that Equipped is here.
– Local Script
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.SelectedTemplate.Value ~= nil and script.Parent.Parent.PetView.PetName.Text ~= nil then
print(script.Parent.Parent.SelectedTemplate.Value)
Remote:FireServer(script.Parent.Parent.PetView.PetName.Text, script.Parent.Parent.SelectedTemplate.Value)
end
end)
In the server, I have : local function EquipPet(player, petName, template)
-- LocalScript
script.Parent.MouseButton1Click:Connect(function()
local value = script.Parent.Parent.SelectedTemplate.Value
local name = script.Parent.Parent.PetView.PetName.Text
if value and name ~= "" then
remote:FireServer(value, name)
end
end)
-- ServerScript
remote.OnServerEvent:Connect(function(player, template, petName)
-- rest of code
end)
Not sure what’s up. Can you take screen shots of your button LocalScript, your server Script, your Output window, and your Explorer window? If I can see all of these as screen shots, I can try to pinpoint the problem.
You have pet templates(frames) displayed in a gui. Then, each time you click on of those, the ObjectValue.Value becomes that clicked template and there’s an info gui showing up the pets stats and an “Equip” button. Then, in another button(equip), when you click it, it gets the value of the ObjectValue and sends it into the server.
The question is : Can server get local Instances through a remote event? Even if it’s nowhere in serverside?
This is the best solution I can come up with at the moment. The only thing I can think of that is preventing this from working is that something is not being referenced correctly (wrong value/name). I’ll get back to you if I can think of another solution.