Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FilteringEnabled Tool Giver?

Asked by 8 years ago
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!

0
Well. I certainly didn't read the question first time. User#6546 35 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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.

Ad

Answer this question