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

please help with this script wont enable the local script ?

Asked by 6 years ago
Edited by Goulstem 6 years ago
local player = script.Parent.Parent.Parent.Parent.Parent
local level = player.leaderstats.Lvl
local price = 0

function buy()
    if level.Value >= price then
        game.StarterPack.SS1.Disabled = false
    end
end

script.Parent.MouseButton1Down:connect(buy)
Format your code correctly
0
works in studio not in game LifeLeafi 0 — 6y
0
Rather than messing with the Disabled property, you should edit the `SS1` code or tool to have the level prerequisite. Goulstem 8144 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

First off, what is script.Parent.Parent.Parent.Parent.Parent? Why are you getting the player like this? You should use Players.LocalPlayer.

The problem with the script was that you tried to enable a script from StarterPack. Anything that goes in the StarterPack, StarterGui, StarterPlayerScripts, or StarterCharacterScripts get cloned to the Backpack, PlayerGui, PlayerScripts, and the player's Character. In this case, your script is in the Backpack. You'd instead look for the script inside the Backpack.

wait()
local player = game:GetService('Players').LocalPlayer
local level = player.leaderstats.Lvl
local price = 0

local function buy(inputObject)
    if level.Value >= price then
        player.Backpack.SS1.Disabled = false
    end
end

script.Parent.Activated:Connect(buy)

0
thx LifeLeafi 0 — 6y
0
Mark it as answer. xAtom_ik 574 — 6y
Ad

Answer this question