I’m making a code door system that pops up a GUI once you click on a keypad. Once you hit enter, the door you interacted with opens if you get the right code.
I send the model through a RemoteEvent in order to identify the door that the player interacted with. However, when the model reaches the clientside script, the “model” argument is nil. Obviously, I don’t want it to be nil.
--server script
script.Parent.Click.ClickDetector.MouseClick:Connect(function(player)
if not debounce then
debounce = true
print(model)
game.ReplicatedStorage.Code:FireClient(player, model)
end
end)
--local script
game.ReplicatedStorage.Code.OnClientEvent:Connect(function(player, model)
print(model) --returns nil
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game:GetService("TweenService"):Create(workspace.CurrentCamera, TweenInfo.new(0.25), {CFrame = CFrame.new(model.Cam.Position)}) --problematic line, returns nil
script.Parent.Parent.Enabled = true
cmodel = model
end)
Is there any way to solve this issue? Alternatively, is there a better way for me to identify the model that fired the event?
Thanks in advance