Clone a script to a player Backpack ( Not on touch script )

I need help with cloning a script into a player’s backpack. I’ve tried anything but it seemed to not work.

Here’s one of the codes I tried:

local Player = game.Players.LocalPlayer
local Script = game.ReplicatedStorage.ScriptsAndExtras.BlackHoleEffect
local Backpack = Player:FindFirstChild("Backpack")
local CloneScript = Script:Clone()
--// Code\\--

wait(3)
CloneScript.Parent = Backpack
2 Likes

Try having the server clone the script instead of the client.

1 Like

I don’t know how to do that … Is it with remote events?

1 Like

Try this:
Local script:

game.ReplicatedStorage.fireforscript:FireServer()
--other stuff

Server script:

game.ReplicatedStorage.fireforscript.OnServerEvent:connect(function(plr)
local script = game.ReplicatedStirage.ScriptsAndExtras.BlackHolrEffect:clone()
script.Parent = plr.Backpack
1 Like

Oh alright man! thank you so much.

Welp, I’ve fixed some things u got wrong there, but it still didn’t work :frowning:

What is the contents of the script being cloned if you don’t mind me asking?
Sorry for the formatting issues, I’m typing this on mobile.

game:GetService("RunService").RenderStepped:connect(function() 
if (distort > 0.001) then
	cam.CoordinateFrame=cam.CoordinateFrame*CFrame.new(0,0,0,distort,0,0,0,distort,0,0,0,1)
	distort = distort - 0.001
end 
end)

I am remaking the normal elevator the old version, and the black hole floor needs this script.

Are you trying to Clone a Script to the Player’s Backpack?

Yes I am, at least I’m trying to

I recommend you to Parent it to the PlayerGui. I don’t think the Backpack is used to hold scripts, unless you are trying to make a Gear or Tool

game.ReplicatedStorage.fireforscript.OnServerEvent:connect(function(plr)
local script = game.ReplicatedStorage.ScriptsAndExtras.BlackHoleEffect:Clone()
script.Parent = plr.PlayerGui

But it doesn’t even clone to the Backpack. I don’t think it will clone to the PlayerGui too

You can test it by placing the BlackHoleEffect script in the StarterGui.
Since the PlayerGui is the same as the StarterGui, except it doesn’t reset the script when the Player Dies.

Any LocalScript will run as soon as it is inserted into a PlayerGui.

What are you using to Activate the Remote Event?

The scripts aren’t working. And I’m putting a local script saying :

game.ReplicatedStorage.fireforscript:FireServer()

whenever the floor is chosen.