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

Tools work when given directly to the client, but not when Clone() is called or Parent is changed?

Asked by
MexheCo 46
5 years ago

I have had this problem across many game, and after hours and hours of scouring the internet, I can find no reason why my problem occurs. I have tried cloning the item from both a client source (a folder in StarterPack), and a Server source (ReplicatedStorage, as shown below.)

What happens is when I attempt to clone a tool (this one) to the player's backpack from Replicated Storage, I run into a problem. I'll list the steps as clearly as I can.

  1. The player clicks a GUI button, running the OnClick() below

  2. The item (in this case, the launcher) is cloned to the backpack successfully, along with all its scripts

  3. When the player attempts to use the Launcher, the scripts do not run. They do run when the item is not cloned.

My OnClick() code:

function onClickEvent()


    local clonedItem = game.ReplicatedStorage.ItemsToBuy.ClassicLauncher:Clone()
    clonedItem.Parent = game.Players.LocalPlayer.Backpack

    end


script.Parent.MouseButton1Click:Connect(onClickEvent)

My place is UnCopylocked here, in case anyone wants to take a look at my GUI hierarchy or anything.

0
that isnt FE compatable theking48989987 2147 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You need to make the tool FE compatible.

What is FE?

Filtering Enabled is when the client can only modify objects for themselves, so if a client (using a client script) deletes an object in the workspace, it will only delete for that client and not replicate across the server model.

To get around this people use events (example: Remote Events) this is when the client asks the server to do a task and the server receives this request and can carry it out.

Some wiki links below may help you. (But in short your script isn't FE compatible)

Remote Events -- Remote Events

Experimental Mode -- What is filtering enabled/Experimental Mode?

Client-Server Model -- How the client interacts with the server and vice-versa

0
Thanks for the details. I'll start working then :p MexheCo 46 — 5y
Ad

Answer this question