Arguement 1 missing or nil on FireClient

Hello! I want to make it so that a player gets morphed into a character and teleported when touching the button.

The morphing system does not currently work, I can’t figure out how to clone the startercharacter from the server so that other players can see yoru character, and I know this is not the best way possible.
If you can either solve the bug or provide another way to morph the character, please tell me below!

I’ve tried asking programmer friends, searching the DevForum, YouTube, and Google, and I have found no solutions.

Also, I know that my teleporting system code is messy, please do not comment just to tell me that.

script:

--Variables
local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters
local players = game:GetService("Players")
local Maps = game.Workspace:FindFirstChild("Maps") --The map folder from workspace
local mainmap = Maps:FindFirstChild("MainMap") --The current map, change to different name
local spawns = mainmap:FindFirstChild("Spawns") --The spawns folder containing all the spawn locations
local t = 1
local db = false

--Messy spawn system
local s1 = spawns:FindFirstChild("Spawn1")
local s2 = spawns:FindFirstChild("Spawn2")
local s3 = spawns:FindFirstChild("Spawn3")
local s4 = spawns:FindFirstChild("Spawn4")
local s5 = spawns:FindFirstChild("Spawn5")
local s6 = spawns:FindFirstChild("Spawn6")

--Functions
buy.Touched:Connect(function(hit)

	local player = game.Players:GetPlayerFromCharacter(hit.Parent)


	local p = players:FindFirstChild(hit.Parent.Name)

	local leaderstats = p:WaitForChild("leaderstats")

	if leaderstats:FindFirstChild("Yen").Value >= 100 then --How much yen character costs

		if hit.Parent:FindFirstChild("Humanoid") then
			
			if db == false then
				db = true
				
				event:FireClient()
				
				
				local random = math.random(1,6)
				
				
				if random == 1 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s1.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 1
				end
				
				if random == 2 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s2.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 2
				end
				
				if random == 3 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s3.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 3
				end
				
				if random == 4 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s4.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 4
				end
				
				if random == 5 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s5.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 5
				end
				
				if random == 6 then
					player.Character:FindFirstChild("HumanoidRootPart").Position = s6.Position + Vector3.new(0, 5, 0) --Randomizing spawning system number 6
				end
				
				
				wait(1)
				db = false
			
			
			
			end
		else
			return
		end
	else
		return
	end
end)

Localscript:

local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters

event.OnClientEvent:Connect(function(player)
	local clone = character:Clone() --Clones the character
	clone.Parent = player.StarterPlayer
	clone.Name = "StarterCharacter"
end)
1 Like

FireClient needs the target player as an argument, try this as a server script.

--Variables
local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters
local players = game:GetService("Players")
local Maps = workspace:FindFirstChild("Maps") --The map folder from workspace
local mainmap = Maps:FindFirstChild("MainMap") --The current map, change to different name
local spawns = mainmap:FindFirstChild("Spawns") --The spawns folder containing all the spawn locations
local t = 1
local db = false

--Messy spawn system
local SpawnsTable = {
	spawns.Spawn1,
	spawns.Spawn2,
	spawns.Spawn3,
	spawns.Spawn4,
	spawns.Spawn5,
	spawns.Spawn6
}

--Functions
buy.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local leaderstats = player:WaitForChild("leaderstats")

	local HRP = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
	if leaderstats:FindFirstChild("Yen").Value < 100 or db or not HRP then    return    end
	db = true
	event:FireClient(player)
	
	local random = math.random(#SpawnsTable)
	HRP.Position = SpawnsTable[random].Position + Vector3.new(0, 5, 0)
	
	task.wait(1)
	db = false
end)
2 Likes


I got this, and the morphing did not work

1 Like

Hello? Are you able to help? It’s still not resolved.

1 Like

this is an external module error likely because your game is not published, thus making it not have any game info. Add a catch to whatever is throwing that promise rejection or remove evaera’s promise module.

1 Like

This is a roblox error they are changing some stuff and it can be ignored.
Your error is because when you call ‘FireClient()’ its first argument is a player object and you need to provide one or else the script will error.

event:FireClient(player)

Is what you’re looking for

2 Likes

I already put the player in the script, but it doesn’t seem to morph

--Variables
local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters
local players = game:GetService("Players")
local Maps = workspace:FindFirstChild("Maps") --The map folder from workspace
local mainmap = Maps:FindFirstChild("MainMap") --The current map, change to different name
local spawns = mainmap:FindFirstChild("Spawns") --The spawns folder containing all the spawn locations
local t = 1
local db = false

--Messy spawn system
local SpawnsTable = {
	spawns.Spawn1,
	spawns.Spawn2,
	spawns.Spawn3,
	spawns.Spawn4,
	spawns.Spawn5,
	spawns.Spawn6
}

--Functions
buy.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local leaderstats = player:WaitForChild("leaderstats")

	local HRP = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
	if leaderstats:FindFirstChild("Yen").Value < 100 or db or not HRP then    return    end
	db = true
	event:FireClient(player)

	local random = math.random(#SpawnsTable)
	HRP.Position = SpawnsTable[random].Position + Vector3.new(0, 5, 0)

	task.wait(1)
	db = false
end)

Whats the script that handles the FireClient()?
Is there a line that sets the players character to the morph?

1 Like

Yes, but I don’t know any way to duplicate the StarterCharacter from the serverscript so that others can see it. So that’s an issue too

local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters

event.OnClientEvent:Connect(function(player)
	local clone = character:Clone() --Clones the character
	clone.Parent = player.StarterPlayer
	clone.Name = "StarterCharacter"
end)

StarterPlayer is not a property of a Player
You need to first clone the character on the server
Parent the clone to workspace
Then set Player.Character to your custom character.
Also OnClientEvent does not pass a Player parameter get the LocalPlayer using

local player = game.Players.LocalPlayer
1 Like

How do I set the player character to the custom avatar?

Player.Character = customavatar
1 Like

Thanks! I never actually knew you could do that, let me try.

So what happend was:
-There was a 2 second lag when my character hit the part
-The character spawned in, but the camera didn’t move
-The character didn’t teleport to a spawn

Thats…really odd
You are doing all this on the server right?
I just tried and it worked fine

Example script I was using

local players = game:GetService('Players')

players.PlayerAdded:Connect(function(plr)
	local chara = plr.Character or plr.CharacterAdded:Wait() -- Just to wait for the players character
	local clone = workspace.Dummy:Clone()
	clone.Parent = workspace
	plr.Character = clone
end)

I was using a dummy but the camera did switch to it with no lag

1 Like
--Variables
local rep = game:GetService("ReplicatedStorage")
local characters = rep:WaitForChild("Characters")
local character = characters:FindFirstChild("Naruto") --Change to character name
local buy = script.Parent
local event = buy.Characters
local players = game:GetService("Players")
local Maps = workspace:FindFirstChild("Maps") --The map folder from workspace
local mainmap = Maps:FindFirstChild("MainMap") --The current map, change to different name
local spawns = mainmap:FindFirstChild("Spawns") --The spawns folder containing all the spawn locations
local t = 1
local db = false

--Messy spawn system
local SpawnsTable = {
	spawns.Spawn1,
	spawns.Spawn2,
	spawns.Spawn3,
	spawns.Spawn4,
	spawns.Spawn5,
	spawns.Spawn6
}

--Functions
buy.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	local leaderstats = player:WaitForChild("leaderstats")

	local HRP = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
	if leaderstats:FindFirstChild("Yen").Value < 100 or db or not HRP then    return    end
	db = true
	character:Clone()
	character.Parent = workspace
	player.Character = character

	local random = math.random(#SpawnsTable)
	HRP.Position = SpawnsTable[random].Position + Vector3.new(0, 5, 0)

	task.wait(1)
	db = false
end)

Is your character rigged properly?
Can you send a screenshot of its hierarchy?

1 Like

image
No animations work either

Any help on this problem? It’s not working

When you clone the character, turn that into a variable, and then try parenting and all that.

1 Like