RemoteFunction not passing model

local model = replicatedStorage.Remotes.Events.GetClassModel:InvokeServer(selected)

print(model)

Server

function game.ReplicatedStorage.Remotes.Events.GetClassModel.OnServerInvoke(player, class)
	local armour = game.ReplicatedStorage.Classes:FindFirstChild(class):FindFirstChild('Armour')
	if not armour then return end
	
	local weapon = game.ReplicatedStorage.Classes:FindFirstChild(class):FindFirstChild('Weapon')
	if not weapon then return end
	
	local armourClone = armour:Clone()
	armourClone.Name = 'ArmourClone'
	
	local weaponClone = weapon:Clone()
	weaponClone.Name = 'WeaponClone'
	
	local character = armourClone
	local humanoid = character.Humanoid
	
	humanoid:EquipTool(weaponClone)	
	return armourClone
end

If I print (armourClone) in the Server, it prints ArmourClone, but it isn’t being passed through to the client?

1 Like

Instances parented to nil will not replicate from server to client. Try parenting armourClone to ReplicatedStorage from the server and see what happens.

1 Like

That seems to work, but the equipping don’t seem to work;

humanoid:EquipTool(weaponClone)
armourClone.Parent = game.ReplicatedStorage
return armourClone

Any idea how to get this to work? Equipping is very important

Set the parent of armourClone before equipping

While this is not an answer to your question why are you doing this?
game.ReplicatedStorage.Classes:FindFirstChild(class):FindFirstChild('Armour')
You do not check if :FindFirstChild(class) is nil.You are assuming that :FindFirstChild(class) will always be there. Also I don’t know why you didn’t make a variable for the ReplicatedStorage in your server script. Indexing the DataModel just to get a service like that is unacceptable. It is too repetitive. D.R.Y. (Don’t repeat yourself).

1 Like

Set parent to rep storage, equipped via server, then returned the model.

Once the client had it, it moved its parent over to workspace. The tool is inside the character, but not equipped :confused:

1 Like

Gimme a sec and I’ll test it.

1 Like

Oh I forgot to mention, this is a really rough script, like really rough. It’s basically just a quick mockup to try seeing if I can get something to work, because everything else I have tried hasn’t worked. So that’s why it’s not the nicest script to look at :sweat_smile: purely just thrown together to try and get something working, and if it works I can go back and redo everything to make it clean, otherwise I can just scrap this without having to worry about spending forever making a nice script, only to have it not work

2 Likes

It seems that humanoids have to be parented to workspace for EquipTool to work. Try parenting armourClone to workspace instead.

Hmmm I can’t really do that :confused: Point of this script was to hopefully get an NPC to be equipping a tool in a customisation screen, but if it’s parented to the workspace by the server then every single player can see that NPC :confused:

Now, more along the lines of the spirit of your inquiry, why not parent to the work space in the client side?

Perhaps you could delete the thus created instance in all other clients locally? It’s not a good solution but that’s all I could think of :confused:

1 Like

Because EquipTool doesnt work from client. It parents the tool to the character, but not actually equip it into its hand

Try what he said.

1 Like

Oh yes that is true. I remember i had issues with that as well before.

Parent armourClone to workspace then move armourClone to some far away place on the server then move it to the correct spot on the client.

Hmmm :confused: I’ll try I guess, really convaluted fix though

I don’t think there are any better fixes for this but I’ll let you know if I find one.

2 Likes