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

My script won't run when the event is fired and I have no idea why.. please help?

Asked by 4 years ago

Alright, this is all fired through a remote event. I have no idea why this isn't working at all. I've tried adding and removing "Player", I've tried rescripting it to from scratch to see if I made an error and I get nothing.. Here's the script I believe has an error.

--Made by MillerrIAm
------------Variables------------
IntroEvent = game.ReplicatedStorage.ShowTronEvents.IntroEvent
TVTop = game.Workspace.TVTop --Overhead Screen
TV = game.Workspace.TV --Main TV Screen
Screen1 = game.Workspace.Screen1 --Left Stage MiniTron
Screen2 = game.Workspace.Screen2 --Right Stage MiniTron
Side1 = game.Workspace.Side1 -- Left Bottom Stage Screen [Extra]
Side2 = game.Workspace.Side2 -- Right Bottom Stage Screen [Extra]
Side3 = game.Workspace.Side3 -- Left Far Jumbo Screen
Side4 = game.Workspace.Side4 -- Right Far Jumbo Screen
Apron1 = game.Workspace.Apron1 --Front Apron
Apron2 = game.Workspace.Apron2 --Left Apron
Apron3 = game.Workspace.Apron3 --Back Apron
Apron4 = game.Workspace.Apron4 --Right Apron
Canvas = game.Workspace.RingCanvas --Ring Cavans/ Ring Matt
TopRope = game.Workspace.TopRope
MiddleRope = game.Workspace.MiddleRope
BottomRope = game.Workspace.BottomRope
LED = game.Workspace.LEDColor
------------Main Script------------
IntroEvent.OnServerEvent:Connect(function(Player,Intro)
    if Intro == "Annihilation" then
        TVTop.Decal.Texture = ""
        TV.Decal.Texture = ""
        Screen1.Decal.Texture = ""
        Screen2.Decal.Texture = ""
        Side1.Decal.Texture = ""
        Side2.Decal.Texture = ""
        Side3.Decal.Texture = ""
        Side4.Decal.Texture = ""
        s = Instance.new("Sound")
        s.Name = "Sound"
        s.Parent = game.Workspace
        s.SoundId = "rbxassetid://3341223012"
        s.Volume = 1
        s.Pitch = 0.87
        s:Play()
        wait(2)
        m = Instance.new("Message")
        m.Parent = game.Workspace
        m.Text = "Song rights to Papa Roach. Song Name: To Be Loved..."
        wait(3)
        m.Text = "Please be reminded that breaking in will be an immediate BAN, champion or not."
        wait(5)
        m.Text = "Tonight we rise..."
        wait(4)
        m.Text = "Welcome everyone to this special edition of..."
        wait(4)
        m.Text = "FRIDAY NIGHT..."
        wait(3)
        m.Text = "AAANNNIIIIIHHHHIIIILLLLAATTTTIIIOOOONNNN"
        wait(4)
        m:Destroy()
        wait(0.1)
        for i,v in pairs (game.Players:GetPlayers()) do 
        local Cut = game.ServerScriptService.Intro1:Clone()
        Cut.Disabled = false
        Cut.Parent = v.Character
        end
        script.Parent.Pyro.Disabled = false
        wait(10)
        m:Destroy()
        s:Stop()
        wait(0.1)
    elseif Intro == "PPV" then
        TVTop.Decal.Texture = ""
        TV.Decal.Texture = ""
        Screen1.Decal.Texture = ""
        Screen2.Decal.Texture = ""
        Side1.Decal.Texture = ""
        Side2.Decal.Texture = ""
        Side3.Decal.Texture = ""
        Side4.Decal.Texture = ""
    end
end)

My button script.

script.Parent.MouseButton1Click(function()
    game.ReplicatedStorage.ShowTronEvents.IntroEvent:FireServer("Annihilation")
end)

Thank you in advance for any help.

0
It's fired through a GUI Button. Just2Terrify 566 — 4y
0
Have you checked the output? DeceptiveCaster 3761 — 4y
0
Nothing pops up, that was the first thing I thought of. Just2Terrify 566 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

you code is kinda of too messy to thoroughly comprehend, but here is a cleaner alternative to what i think you want to make..

--server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local onActivateGameMode= ReplicatedStorage.ble.bleh -- remote event directory

local message_time = 3

local messages = {
    annihilation = {
        configure = function()  
            print("making configurations for the game mode")
        end

        messages = {
            "Hey, my name is annihilation",
            --more messages here!
        }
    }




    ppv= {
        configure = function()  
            print("making configurations for the game mode")
        end

        messages = {
            "Hey there, I am ppv",
            --more messages here!
        }
    }


}



function onServerEvent(player, mode)
    local mode_info= messages[mode:lower()]
    local mode_messages = mode_info.messages

    if(mode_info.configure) then
        mode_info.configure() -- to do any some of configuration for a specific game mode!  
    end


    for _, message in pairs(mode_messages ) do
        --do something with the message
        print(message)
        local extra_time = 0.1 * #message

        wait(message_time + extra_time)
    end
end

onActivateGameMode.OnServerEvent:Connect( onServerEvent )

--in localscript

local onActivateGameMode= ReplicatedStorage.ble.bleh -- remote event directory
local button = --directory to button

button.MouseButton1Down:Connect(function()
    onActivateGameMode:FireServer("PPV")
end)

further more, you can put the messages in a Module Script, to make the code easier to read..

0
Alright, I respect this style and if I was doing something different... I'd use this but I kind of need it to be in this order.. On-top of that, I don't know much about Module scripts... lol. Thank you for the help though but I just want to know why my script isn't firing correctly. Just2Terrify 566 — 4y
1
Try opening the output and see if there is any errors.. User#23252 26 — 4y
0
I now know what Module Scripts are and I looked into this and this was a lot nicer, thank you very much. Just2Terrify 566 — 4y
Ad

Answer this question