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

How do you get an item from server to client in FE?

Asked by
Scaii_0 145
5 years ago

So, a script in the player detects a click and is then meant to find a tool in ServerScriptService and clone it to the player.

So far when I try this:

--click function (works)
local plr = game.Players.LocalPlayer
local tool = game.ServerScriptService.Tool:Clone()
tool.Parent = plr

It says there is no tool. I understand this is because client can't access the server. But how would I get the tool over to the player?

0
You can simply parent the tool to the player's character or backpack from the server. No need for a client. nilVector 812 — 5y
0
But I can't access the tool because its in the server, but the script is in client. Scaii_0 145 — 5y
0
Can’t you just use ReplicatedStorage instead? Both server and client can access it. User#20279 0 — 5y
0
I've tried, but being in ReplicatedStorage interferes with the Tool's scripts. Scaii_0 145 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Local Script:

--click function
RemoteEvent:FireServer()

Server Script:

local tool = game.ServerScriptService.Tool

RemoteEvent.OnServerEvent:Connect(function(plr)
    local toolClone = tool:Clone()
    toolClone.Parent = plr
end)
Ad

Answer this question