On lines 13/14 of the Event Receive Script I get the error "ServerScriptService.RecieveEvents:13: bad argument #2 to '?' (string expected, got Object)" How can i fix this or find a way around it?
--Event FireScript
-----------------------Events---------------------------------------
local CharacterChosen = game:GetService("ReplicatedStorage").CharacterChosen
----------------------Workspace Models---------------------------------------
local RecruitLoadoutModel = workspace.Recruit
local DecoyLoadoutModel = workspace.Decoy
local StrikerLoadoutModel = workspace.Striker
local CaliaLoadoutModel = workspace.Calia
local BlasterLoadoutModel = workspace.Blaster
-----------------------Player Models---------------------------------------
local RecruitCharacterModel = game:GetService("ServerStorage").Recruit
local StrikerCharacterModel = game:GetService("ServerStorage").Striker
local DecoyCharacterModel = game:GetService("ServerStorage").Decoy
local CaliaCharacterModel = game:GetService("ServerStorage").Calia
local BlasterCharacterModel = game:GetService("ServerStorage").Blaster
local Player = game.Players.LocalPlayer
-----------------------Functions---------------------------------------
function Recruit()
print("Clicked")
local Character = Recruit
if RecruitLoadoutModel.Availability.Value == true then
print("trying to fire event")
CharacterChosen:FireServer(Player, Character)
print("fired from local")
end
end
function Striker()
print("Clicked")
local Character = Striker
if StrikerLoadoutModel.Availability.Value == true then
CharacterChosen:FireServer(Player, Character)
end
end
function Decoy()
print("Clicked")
local Character = Decoy
if DecoyLoadoutModel.Availability.Value == true then
CharacterChosen:FireServer(Player, Character)
end
end
function Calia()
print("Clicked")
local Character = Calia
if CaliaLoadoutModel.Availability.Value == true then
CharacterChosen:FireServer(Player, Character)
end
end
function Blaster()
print("Clicked")
local Character = Blaster
if BlasterLoadoutModel.Availability.Value == true then
CharacterChosen:FireServer(Player, Character)
end
end
-----------------------Connect Functions---------------------------------------
script.Parent.Recruit.MouseButton1Click:connect(Recruit)
script.Parent.Striker.MouseButton1Click:connect(Striker)
script.Parent.Decoy.MouseButton1Click:connect(Decoy)
script.Parent.Calia.MouseButton1Click:connect(Calia)
script.Parent.Blaster.MouseButton1Click:connect(Blaster)
--Event ReciveScript
--Receiving RemoteFuction Script
-----------------------Events---------------------------------------
local CharacterChosen = game:GetService("ReplicatedStorage").CharacterChosen
-----------------------Player Models---------------------------------------
local TheRecruitCharacterModel = game:GetService("ServerStorage").Recruit
local TheStrikerCharacterModel = game:GetService("ServerStorage").Striker
local TheDecoyCharacterModel = game:GetService("ServerStorage").Decoy
local TheCaliaCharacterModel = game:GetService("ServerStorage").Calia
local TheBlasterCharacterModel = game:GetService("ServerStorage").Blaster
-----------------------Functions---------------------------------------
function ChoseCharacter(Player, Character)
print("fired from server")
workspace[Character].Availability.Value = false
workspace[Character].Head.GUI.Availability.Text = Player.Name
local ClonedModel = game:GetService("ServerStorage")[Character]:Clone()
ClonedModel.Parent = workspace
ClonedModel.Name = Player.Name
Player.Character = ClonedModel
workspace.CurrentCamera:Destroy()
wait()
workspace.CurrentCamera.CameraType = "Custom"
workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character[("Humanoid")]
end
-----------------------Connect Functions---------------------------------------
CharacterChosen.OnServerEvent:Connect(ChoseCharacter)

2 comments
Why do you have "[Character]" on lines 13 and 14?
Because the character name is chosen depending on which button they pressed, so the name is never the same. So i used local Character as the model name.