#Why is this LocalScript misbehaving??

1 messages · Page 1 of 1 (latest)

elder loom
#

I have a LocalScript thats only ment to run once ... like very local script
But for some reason its running every time i click a button, and its not even referred to in the script!

If this helps, heres the script:

local list = script.Parent.Parent.Parent:WaitForChild("List")
for _, v in pairs(game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("ScreenGui").List:WaitForChild("List"):GetChildren()) do 
    local cv = v:Clone()
        cv.Parent = list
end

local searchmodule = require(game:GetService("ReplicatedStorage"):WaitForChild("SearchBar"))
script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
    searchmodule.tagTable(script.Parent, list)
end)
#

above is also the exlorer tab

#

if anyone can help debug thatll be great

final pumice
#

i can’t see the full explorer tab but I would assume that you end up cloning an ancestor of the script (as cv clone), thus cloning the script and having it run multiple times

elder loom
#

the localscript when it starts is in replicated storage

#

but for some reason it only activates when the extra button is clicked

#

heres the script in the extra button if u need it

local button = script.Parent
local guiFolder = game:GetService("ReplicatedStorage"):WaitForChild("GUI")
local settingsMenu = guiFolder:WaitForChild("moreStuff")
local variable480 = guiFolder:WaitForChild("moreStuffBG") -- named by my friend
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.75, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)
local gui = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui

button.MouseButton1Click:Connect(function()
    settingsMenu.Parent = gui
    variable480.Parent = gui
    tweenService:Create(settingsMenu, tweenInfo, {Size = UDim2.new(0.8, 0, 0.8, 0)}):Play()
    tweenService:Create(variable480, tweenInfo, {BackgroundTransparency = 0.5}):Play()
end)
elder loom
#

@final pumice solved it

#

it was because it was in replicated storage which doesnt fire local scripts automatically or smth

#

but i put it in starter player scripts and it worked