Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

FilteringEnabled Tool Giver?

GiveTool.OnServerInvoke = function(player,Name)
	local cartool = game.ReplicatedStorage:WaitForChild("CarTool")
	if cartool then
			cartool = cartool:Clone()
			cartool["Car"].Value = Name
			print('CARTOOL FOUND')
			return cartool
	end
		end

The code above is in a script in ServerScriptService and the ServerInvoke is in a LocalScript in StarterGui. The cartool is found but it says it's nil when it's returned to the localscript. Is there a better way of giving a tool in an FE game? Am I doing something wrong? Thanks in advance!

1 comment

0

Well. I certainly didn't read the question first time.

1 answer

✓ Accepted answer

Replication

If something can't be replicated across the network, it can't be used as an argument or return for networked methods.


When you try to send an Instance across the network, Roblox sends its GUID instead of the information about the Instance in particular. This means that if it's not replicated, the GUID resolves to nothing and becomes nil. In this case, that means that when you try to return something without it being Parented to anything replicated, it will be resolved to nil.

In this case, you need to Parent the new cartool to Workspace or ReplicatedStorage.

This discussion is preserved as it was. New answers, comments, and votes are closed.