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

Why Does My LocalScript Not Work When Cloned Into A Player's Backpack?

Asked by 7 years ago
Edited 7 years ago

I have a script that clones a LocalScript from ServerStorage to a Player's Backpack. The LocalScript works perfectly fine with no errors if I have it in StarterPack when a Player joins the game, but if I clone the LocalScript into a Player's Backpack after they have joined the game, the LocalScript just simply doesn't work. The LocalScript code has no errors and the Script that is putting the LocalScript into the Player's Backpack is just a simple GUI Button that has a Script in it to do so, the LocalScript DOES go into the Backpack, but then, doesn't work like how it should. Any help?

Edit:

Code:

In the Button's LocalScript:

01Button = script.Parent
02GUI = script.Parent.Parent
03Player = game.Players.LocalPlayer
04 
05Button.MouseButton1Click:connect(function()
06    GUI.Visible = false
07    Player.leaderstat.Class.Value = script.Parent.Parent.Parent.Background.Description.Class.Value
08    if Player.leaderstat.Class.Value == "Guardian" then
09        local Moves = game.ReplicatedStorage.Guardian:Clone()
10        Moves.Parent = Player.Backpack
11        wait(0.5)
12        Moves.Disabled = false
13    elseif Player.leaderstat.Class.Value == "Warrior" then
14        local Moves = game.ReplicatedStorage.Warrior:Clone()
15        Moves.Parent = Player.Backpack
View all 23 lines...

In the LocalScript that is being cloned, that isn't working for some reason:

01local Player = game.Players.LocalPlayer
02local Character = Player.CharacterAdded:Wait()
03local mouse = Player:GetMouse()
04local Equipped = false
05local UsedOnce = false
06 
07game:GetService("UserInputService").InputBegan:Connect(function(key)
08    if key.KeyCode == Enum.KeyCode.F and Equipped ==  false and UsedOnce == false then
09 
10---Etc, etc, etc
11 
12end)
0
Maybe put move the script to ReplicatedStorage, that worked for me Fsxfighter265 10 — 7y
0
tried that, didn't work. Wolf5429 15 — 7y

1 answer

Log in to vote
0
Answered by
imaski4 42
7 years ago

hey bub. paste ur code ill fix it up <3

0
There you go. Wolf5429 15 — 7y
Ad

Answer this question