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

Remote Event is not being triggered. Please help, what am I doing wrong?

Asked by 5 years ago
Edited 5 years ago

EVERYTHING IN BOLD FROM HERE ON OUT IS WHERE EVERY SCRIPT IS LOCATED. ABOVE IT IS WHAT TYPE OF SCRIPT IT IS. Alright so, this is suppose to trigger the event and change the pointlights color that is inside parts that is also inside a model. The first script is the one i'm having issues with, its a local script trying to fire server and it won't allow the FireClient or FireAllClients to happen. This script is a local script. game.Workspace.ArenaLights.White

Power = script.Parent.Power
--Made By MillerrIAm
--Helpers Liliardio & WeArefSociety
--------------------------------------------------------------------
--Start Script
function change()
    game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")
end
script.Disabled = true

This is what is suppose to to call for the script above to work. #2 This is a script, not local or module. game.Workspace.TronsFolder[NewTron].Main[Script|ArenaLights]

Power = script.Parent.Power
ArenaLights = game.Workspace.ArenaLights
--Made By MillerrIAm
--Helpers Liliardio & WeArefSociety
--------------------------------------------------------------------
--Start Script
Power.Changed:Connect(function(Value)
    if Value then
        while Power.Value do
            ArenaLights.White.Disabled = false
            wait(0.1)
            ArenaLights.Blackout.Disabled = false 
            wait(0.1) --Just duplicate this and the line above.
        end
    end
end)

This script works perfectly fine but I figured it could help.#3 This is a script, not a local script or a module script. game.ServerScriptStorage[Scripts|LightingEvents].[Script|ArenaLighting]

Lighting = game:GetService('Lighting') -- This line isn't needed though.
ReplicatedStorage = game.ReplicatedStorage
parts = game.Workspace.ArenaLights:GetChildren() 
--------------------------------
game.ReplicatedStorage.LightingEvents.ArenaLightsEvent.OnServerEvent:Connect(function(player,arenalight)
    local children = game.Workspace.ArenaLights:GetChildren()
    if arenalight == "BrightWhite" then --White Lighting
      for i, v in pairs(children) do
        if v:FindFirstChild("PointLight") ~= nil then
          v.PointLight.Color = Color3.fromRGB(255, 255, 255)
        end
      end
      wait(0.01)
    elseif arenalight == "White" then
      for i, v in pairs(children) do
        if v:FindFirstChild("PointLight") ~= nil then
          v.PointLight.Color = Color3.fromRGB(255, 255, 255)
        end
      end
      wait(0.01)
    elseif arenalight == "Blackout" then
      for i, v in pairs(children) do
        if v:FindFirstChild("PointLight") ~= nil then
          v.PointLight.Color = Color3.fromRGB(0, 0, 0)
        end
      end
      wait(0.01)
    end
end)

Thank you in advance for any help, comments & answers!

3 answers

Log in to vote
1
Answered by
BuDeep 214 Moderation Voter
5 years ago

The first issue I'm seeing is with your first script being a LocalScript in workspace. The only way a local script will run is if it is a descendant of the following:

-A Player’s Backpack , such as a child of a Tool

-A Player’s Player/Character|character model

-A Player’s PlayerGui

-A Player’s PlayerScripts .

-The ReplicatedFirst service

Now a second issue I'm seeing is you're using Remote Events when their is no communication between the Client and the Server. The solution to this is to use something called "Bindable Events", which excel at server-side communication. Here is a wiki article showing you how to use them:

https://developer.roblox.com/en-us/api-reference/event/BindableEvent/Event

In conclusion, change your local script to a server script, and switch your events to Bindable Events.

0
Don't forget to call your function as well! BuDeep 214 — 5y
Ad
Log in to vote
0
Answered by
Echtic 128
5 years ago

Try deleting the function in the first script, that should do the trick.

0
Function Change()? Just2Terrify 566 — 5y
0
That did nothing. Just2Terrify 566 — 5y
0
then u can try just making the second script local and making it trigger the server event, u don't need 3 scripts for this Echtic 128 — 5y
0
Also since the first script is local it's not working cause it's in workspace, it has to be in the player gui in order to work Echtic 128 — 5y
View all comments (3 more)
0
I'll see if I can. I attempted that and it failed. Do you have discord? I can show you. Just2Terrify 566 — 5y
0
It can still work with 3 scripts u just have to modify them a little, but it would be easier for u if it were just 2 Echtic 128 — 5y
0
MLOH #3697 Echtic 128 — 5y
Log in to vote
0
Answered by 5 years ago

I believe the issue might be that your Change() Function is never being fired. You have set the Function but not called it. Try doing this:

Power = script.Parent.Power
--Made By MillerrIAm
--Helpers Liliardio & WeArefSociety
--------------------------------------------------------------------
--Start Script
function change()
    game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")
end

change()
script.Disabled = true

or

Power = script.Parent.Power
--Made By MillerrIAm
--Helpers Liliardio & WeArefSociety
--------------------------------------------------------------------
--Start Script
game.ReplicatedStorage.LightingEvents.ArenaLightsEvent:FireServer("White")

script.Disabled = true

Other then that, I can't find anything else wrong. Hope this fixes the problem. Best of Luck!

Answer this question