You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want the easiest way to reference players who activate the triggers for certain events. -
What is the issue? Include screenshots / videos if possible!
As of now i had the code with FireAllClients and then i realized it makes stuff appear for everyone on trigger.
Example: Someone grabs a key, that triggers the event that updates the objectives and such but for everyone, even people without the key.
I want to change it to FireClient so it only appears to whoever procs the triggers, BUT i dont know how to define the player and keep getting errors, im noob at scripting.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Videos, tutorials, some other posts on the forums but im not sure where to put the lines of code and some community discords but no luck to fix the problem as id want to yet.
Also my script is based on this video: ROBLOX Studio Horror Game Tutorial Part 1 - YouTube
My main issue would be that the triggers get destroyed when procc, so if i were to change it to FireClient i think i would need the triggers to stay BUT i use the following line to change the texts and dont know for what i could replace it.
repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("TriggerDialogue1") == nil
As for the full code, its here.
This one is my Main Script, its on ServerScriptService
local DialogueEvent = game.ReplicatedStorage.RemoteEventsTasks:FindFirstChild("DialogueEvent")
local ObjectiveEvent = game.ReplicatedStorage.RemoteEventsTasks:FindFirstChild("ObjectiveEvent")
local ToggleDialogueEvent = game.ReplicatedStorage.RemoteEventsTasks:FindFirstChild("ToggleDialogueEvent")
local ToggleObjectiveEvent = game.ReplicatedStorage.RemoteEventsTasks:FindFirstChild("ToggleObjectiveEvent")
local function MainGame()
ToggleDialogueEvent:FireAllClients(true) --TOGGLES DIALOGUE TO VISIBLE
DialogueEvent:FireAllClients("We finally arrived, i should find the rest of the crew") --WHAT DIALOGUE YOU WANT
wait(8)
ToggleDialogueEvent:FireAllClients(false) --TOGGLES DIALOGUE TO INVISIBLE
ToggleObjectiveEvent:FireAllClients(true) --TOGGLES OBJECTIVE TO VISIBLE
ObjectiveEvent:FireAllClients("Find the Key for the Church") --WHAT OBJECTIVE YOU WANT
repeat wait() until game.Workspace.Triggers.DialogueTriggers:FindFirstChild("TriggerDialogue1") == nil --THE TRIGGER ON TOUCH FOR A NEW DIALOGUE/OBJECTIVE (FINDING LOGAN)
ToggleDialogueEvent:FireAllClients(true) --TOGGLES DIALOGUE TO VISIBLE
DialogueEvent:FireAllClients("Who is that across the lake? I should get closer and talk with him") --WHAT DIALOGUE YOU WANT
wait(8)
ToggleDialogueEvent:FireAllClients(false) --TOGGLES DIALOGUE TO INVISIBLE
repeat wait() until game.Workspace.Triggers.ObjectiveTriggers.ChurchKeySpawner:FindFirstChild("Hitbox") == nil --THE TRIGER ON TOUCH FOR A NEW DIALOGUE/OBJECTIVE (FINDING CHURCH KEY)
ToggleDialogueEvent:FireAllClients(true) --TOGGLES DIALOGUE TO VISIBLE
DialogueEvent:FireAllClients("Found the Key, now to the Church and see what it opens") --WHAT DIALOGUE YOU WANT
wait(8)
ToggleDialogueEvent:FireAllClients(false) --TOGGLES DIALOGUE TO INVISIBLE
ToggleObjectiveEvent:FireAllClients(true) --TOGGLES OBJECTIVE TO VISIBLE
ObjectiveEvent:FireAllClients("Use the Key inside the Church") --WHAT OBJECTIVE YOU WANT
repeat wait() until game.Workspace.Triggers.ObjectiveTriggers:FindFirstChild("ArriveCrematorium") == nil --THE TRIGER ON TOUCH FOR A NEW DIALOGUE/OBJECTIVE (REACH CREMATORIUM)
ToggleDialogueEvent:FireAllClients(true) --TOGGLES DIALOGUE TO VISIBLE
DialogueEvent:FireAllClients("The Church trapdoor was finally opened") --WHAT DIALOGUE YOU WANT
wait(8)
ToggleDialogueEvent:FireAllClients(false) --TOGGLES DIALOGUE TO INVISIBLE
ToggleObjectiveEvent:FireAllClients(true) --TOGGLES OBJECTIVE TO VISIBLE
ObjectiveEvent:FireAllClients("Find a way out of the Crematorium") --WHAT OBJECTIVE YOU WANT
end
wait(25)
MainGame()
And my triggers script is this
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
script.Parent:Destroy()
end
end)
Would greatly appreciate if someone could help out, thanks for the read