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

Why won't my script work? [ANSWERED] [closed]

Asked by 9 years ago

So, I just made this but it doesn't work!

Please can someone tell me!

function onClicked()
    local h = Instance.new("Message")
    h.Parent = game.Workspace
    h.Text = "Attention!"
    wait(5)
    h.Text = "Self Destruct Activated!"
    wait(5)
    h.Text = "You have two minutes to evacuate!"-----You can adjust time if you wish but make sure you remove any extra wait command thingies
    wait(5)
    h.Text = "90 Seconds!"
    local s = Instance.new("Smoke")----- This creates smoke simply for the effect!
    s.Parent = game.Workspace.SDS.SBrick1----- You can add more smoke scripts by making new bricks and copying this line with new bricks name!
    wait(5)
    h.Text = "60 Seconds!"
    wait(5)
    h.Text = "45 Seconds!"
    wait(5)
    h.Text = "30 Seconds!"
    wait(5)
    h.Text = "15 Seconds!"
    wait(5)
    h.Text = "10 Seconds!"
    wait(5)
    h.Text = "5 Seconds!"
    wait(5)
    h.Text = "Initiating Self Destruct!"
    wait(5)
    s.Remove()
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e.Remove()
    wait(5)
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e.Remove()
    wait(5)
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e.Remove()
    wait(5)
    h.Remove()
end
script.Parent.SelfD.MouseClick:connect(onClicked)

17:34:46.697 - Expected ':' not '.' calling member function Remove 17:34:46.698 - Script 'Workspace.SDS.SD.Script', Line 28 17:34:46.698 - Stack End

Best regards, Nathan

Locked by Shawnyg and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 9 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
function onClicked()
    local h = Instance.new("Message")
    h.Parent = game.Workspace
    h.Text = "Attention!"
    wait(5)
    h.Text = "Self Destruct Activated!"
    wait(5)
    h.Text = "You have two minutes to evacuate!"-----You can adjust time if you wish but make sure you remove any extra wait command thingies
    wait(5)
    h.Text = "90 Seconds!"
    local s = Instance.new("Smoke")----- This creates smoke simply for the effect!
    s.Parent = game.Workspace.SDS.SBrick1----- You can add more smoke scripts by making new bricks and copying this line with new bricks name!
    wait(5)
    h.Text = "60 Seconds!"
    wait(5)
    h.Text = "45 Seconds!"
    wait(5)
    h.Text = "30 Seconds!"
    wait(5)
    h.Text = "15 Seconds!"
    wait(5)
    h.Text = "10 Seconds!"
    wait(5)
    h.Text = "5 Seconds!"
    wait(5)
    h.Text = "Initiating Self Destruct!"
    wait(5)
    s:Remove()
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e:Remove()
    wait(5)
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e:Remove()
    wait(5)
    local e = Instance.new("Explosion")
    e.Parent = game.Workspace.SDS.EBrick1
    e:Remove()
    wait(5)
    h:Remove()
end
script.Parent.SelfD.MouseClick:connect(onClicked)

Ad
Log in to vote
1
Answered by 9 years ago

The error is simple, you put . when you were supposed to put a : The script corrected & simplified

script.Parent.SelfD.MouseClick:connect(function ()
    local h = Instance.new("Message",game.Workspace)
    h.Text = "Attention!"
    wait(5)
    h.Text = "Self Destruct Activated!"
    wait(5)
    h.Text = "You have two minutes to evacuate!"
    wait(5)
    h.Text = "90 Seconds!"
    local s = Instance.new("Smoke",game.Workspace.SDS.SBrick1)
    wait(5)
    h.Text = "60 Seconds!"
    wait(5)
    h.Text = "45 Seconds!"
    wait(5)
    h.Text = "30 Seconds!"
    wait(5)
    h.Text = "15 Seconds!"
    wait(5)
    h.Text = "10 Seconds!"
    wait(5)
    h.Text = "5 Seconds!"
    wait(5)
    h.Text = "Initiating Self Destruct!"
    wait(5)
    s:Remove()
    local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)
    e:Remove() -- You should put a "wait()" before this so the explosion doesn't auto remove when created  ~tyopido
    wait(5)
    local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)
    e:Remove() -- Same as line 28 ~tyopido
    wait(5)
    local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)
    e:Remove() -- Same as line 28 ~tyopido
    wait(5)
    h:Remove()
end)
Log in to vote
0
Answered by 9 years ago

Because script.Parent.SelfD.MouseClick:connect(function ()

02 local h = Instance.new("Message",game.Workspace)

03 h.Text = "Attention!"

04 wait(5)

05 h.Text = "Self Destruct Activated!"

06 wait(5)

07 h.Text = "You have two minutes to evacuate!"

08 wait(5)

09 h.Text = "90 Seconds!"

10 local s = Instance.new("Smoke",game.Workspace.SDS.SBrick1)

11 wait(5)

12 h.Text = "60 Seconds!"

13 wait(5)

14 h.Text = "45 Seconds!"

15 wait(5)

16 h.Text = "30 Seconds!"

17 wait(5)

18 h.Text = "15 Seconds!"

19 wait(5)

20 h.Text = "10 Seconds!"

21 wait(5)

22 h.Text = "5 Seconds!"

23 wait(5)

24 h.Text = "Initiating Self Destruct!"

25 wait(5)

26 s:Remove()

27 local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)

28 e:Remove() -- You should put a "wait()" before this so the explosion doesn't auto remove when created ~tyopido

29 wait(5)

30 local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)

31 e:Remove() -- Same as line 28 ~tyopido

32 wait(5)

33 local e = Instance.new("Explosion",game.Workspace.SDS.EBrick1)

34 e:Remove() -- Same as line 28 ~tyopido

35 wait(5)

36 h:Remove()

37 end)