Tool Doesn't work when in replicated storage

I have a tool for a Gamepass that is located within replicated storage. But when it is moved from replicated storage to my backpack it dosent work anymore. I really need to fix this quickly :sweat_smile:

my script that checks if the player owns the pass in located in StarterGui
and the tool is located in replicated storage

1 Like

What type of script are you using to move it from ReplicatedStorage to a player’s backpack? A “Script” or “LocalScript”?

1 Like

Local, and here is that script.

local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,94747658)

if ownsGamepass then
	local DualGravityCoil = game:GetService("ReplicatedStorage"):WaitForChild("DualGravityCoil"):Clone()
	DualGravityCoil.Parent = player.Backpack
end
1 Like

Gotcha. Using solely a LocalScript is your issue. It’s a bit funky at first, but you have to set it up in a different way.

You’re going to need to use a RemoteEvent to do this (follow the “Client To Server” example):

In a nutshell:

  • Create a RemoteEvent somewhere the player can access (e.g. ReplicatedStorage)
  • Fire that RemoteEvent using the LocalScript
  • Create a Script that listens to an event for when the RemoteEvent is fired
  • Handle your gamepass check and tool cloning in that Script instead

Roblox uses this setup to prevent exploiters from having too much unchecked power.

1 Like

Yeah you are right.I made this scripts and he need to create RemotEvent in ReplicatedStorage called ItemMove,First script is local script and next one you need to use in ServerScriptService:

local player = game.Players.LocalPlayer
local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,94747658)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ItemMove = ReplicatedStorage:WaitForChild("ItemMove")

if ownsGamepass then
      ItemMove:FireServer()
end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ItemMove = ReplicatedStorage:WaitForChild("ItemMove")
local DualGravityCoil = ReplicatedStorage:WaitForChild("DualGravityCoil"):Clone()
ItemMove.OnServerEvent:Connect(function(player)
    local Backpack = player:WaitForChild("Backpack")
    DualGravityCoil.Parent = Backpack
end)
4 Likes

Oh wait you need to use this because it will clone only one time so this script will be better:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ItemMove = ReplicatedStorage:WaitForChild("ItemMove")
ItemMove.OnServerEvent:Connect(function(player)
    local DualGravityCoil = ReplicatedStorage:WaitForChild("DualGravityCoil"):Clone()
    local Backpack = player:WaitForChild("Backpack")
    DualGravityCoil.Parent = Backpack
end)
2 Likes

Yes thanks, I was literally just coming back here to ask about that :sweat_smile:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.