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

Script isn't starting after being activated.. Why?

Asked by
TrollD3 105
9 years ago

I made an intro script for all players. The script has 6 children which are all scripts to lerp 6 bricks. The Intro script stops at Loading Part2. I deactivated the brick scripts so they wouldnt run until I needed it too. there are additional 2 scripts near the bottom. The first one is used to run bricks 1-4. The second one is used to run bricks 5-6. It is a local script inside the StarterGui

INTRO SCRIPT!!

--if I enter a wait  here (nothing works)

local FB = game.ReplicatedStorage.firstblack
local FG = game.ReplicatedStorage.firstgold
local SB = game.ReplicatedStorage.secondblack
local SG = game.ReplicatedStorage.secondgold
local TB = game.ReplicatedStorage.thirdblack
local TG = game.ReplicatedStorage.thirdgold

local intro = game.ReplicatedStorage.introbuilding
local cam = game.Workspace.CurrentCamera
local find = game.Workspace.CurrentCamera:FindFirstChild("SG")



cam.CameraType = "Scriptable"

print("Check")
function logo()
    wait(1)
    print("Check2")
    local Sound = game.Players.LocalPlayer.PlayerGui.Sound
local Sound2 = game.Players.LocalPlayer.PlayerGui.Sound2
    Sound:Clone()

print("Loading Part 1")
intro:Clone().Parent = cam
Sound2:Clone()
print("Loading Part 1.5")
FB:Clone().Parent = cam
FG:Clone().Parent = cam
SB:Clone().Parent = cam
SG:Clone().Parent = cam
TG:Clone().Parent = cam
TB:Clone().Parent = cam




wait(.5)
 -- The sounds cannot be in workspace becuase everyone would hear it ....
-- so do I clone it to the Local player? 
Sound2:Play()
wait(.5)
print("Loading Part 2")
script.FG.Disabled = false
script.FB.Disabled = false
script.TG.Disabled = false
script.TB.Disabled = false
script.SG.Disabled = false
script.SB.Disabled = false

if  find then 

        repeat
    wait(.10)
    Sound.Volume = Sound.Volume-.15
until
Sound.Volume <= 0

        --- there isnt an end so Idk if this will break the script cause Sound2 cant play yet...
---Possible error?
print("Loading Part 3")
Sound:Play()
Sound.Looped = true -- the end.




end
   end
logo()




These are the brick scripts. They only these scripts are used for the 6 bricks.




local FB = game.Workspace.CurrentCamera:FindFirstChild("firstblack") if FB then wait(1) local start = Vector3.new(-80.094, 15.182, -39.601) local endit = Vector3.new(-73.914, 15.182, -39.601) for i = 0, 1, .009 do wait(0.001) FB.Position = start:Lerp(endit, i) end end

The remaining 2 scripts

--USED FOR SG AND SB with different variables!!



local SB = game.Workspace.CurrentCamera:FindFirstChild("SB")


function visible()
    wait(8)
    if SB then
    wait(1)
    repeat 
        wait(.045)
        SB.Transparency = script.Parent.Transparency-.1 
    until
    script.Parent.Transparency == 0
    end
    end
visible()
0
Is this a LocalScript? Where? When is it supposed to run? User#6546 35 — 9y
0
Its a script inside the work space. The scripts are supposed to be enabled after I turn the disabled off. TrollD3 105 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You can't use LocalPlayer inside of a regular Script

Most of the code you are using is incompatible with itself. You shouldn't need to use LocalPlayer in a Script, and you shouldn't be using PlayerAdded in a LocalScript. Similarly, you can't use LocalScripts in Workspace.

You need to reconsider the structure of your game and the architecture of your scripts.

0
Its not a local script.. Its a regular script inside workspace TrollD3 105 — 9y
0
And I have used BOTH before in a regular script which work perfectly fine.. TrollD3 105 — 9y
0
That's what I'm saying - If it's a Script, LocalPlayer isn't going to point to anyone (Unless you use it in Studio) User#6546 35 — 9y
Ad

Answer this question