So, I am trying to make a court kind of thing in my game where you can choose options to talk to an npc.
Some options you choose to cause you to get falsely proven guilty. Some options cause you to progress the court session.
So basically Ace Attorney.
To get the different options you press a text button. But, for some reason when you press the correct button, it plays what’s supposed to happen but after, it plays another option ending.
Script:
local CameraChange = game.ReplicatedStorage.CameraChange
local ChangeText = game.ReplicatedStorage.ChangeText
local ChangeImage = game.ReplicatedStorage.ChangeImage
local Nickname = game.ReplicatedStorage.Nickname
local ChooseEvent = game.ReplicatedStorage.ChooseEvent
local ChooseEvent2 = game.ReplicatedStorage.ChooseEvent2
local ChooseEvent3 = game.ReplicatedStorage.ChooseEvent3
local RestartEvent = game.ReplicatedStorage.RestartEvent
game.ReplicatedStorage.ChooseEvent.OnServerEvent:Connect(function()
print("Choice1")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("You're wrong!")
wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("That isn't much of an argument. All you said was that he is wrong.")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
wait(3)
CameraChange:FireAllClients(workspace.CutscenePart6)
ChangeText:FireAllClients("The adventurer is probably bad at arguing. I say the adventurer posessed him with his own mind!")
ChangeImage:FireAllClients("rbxassetid://8130394889")
Nickname:FireAllClients("West (Cowboy 2)")
wait(3)
ChangeText:FireAllClients("Good argument! I find the defendant guilty!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
wait(3)
game.ReplicatedStorage.Screen.Parent = game.Lighting
wait(2)
RestartEvent:FireAllClients()
end)
ChooseEvent2.OnServerEvent:Connect(function()
print("Choice2")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("Last year you said the scientist was a wizard!")
wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("Good point!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
end)
ChooseEvent3.OnServerEvent:Connect(function()
print("Choice3")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("Agreed.")
wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("This is certainly a change of events! If your own defender disagrees, then you are proven guilty!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
wait(3)
game.ReplicatedStorage.Screen.Parent = game.Lighting
wait(2)
RestartEvent:FireAllClients()
end)
I tried cleaning your code, although I was unable to identify the problem. I think the issue may be client-sided(the user firing 2 remotes at once)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ChooseEvent = ReplicatedStorage:WaitForChild("ChooseEvent")
local CameraChange = ReplicatedStorage:WaitForChild("CameraChange")
local ChangeText = ReplicatedStorage:WaitForChild("ChangeText")
local ChangeImage = ReplicatedStorage:WaitForChild("ChangeImage")
local Nickname = ReplicatedStorage:WaitForChild("Nickname")
ReplicatedStorage.ChooseEvent.OnServerEvent:Connect(function()
print("Choice1")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("You're wrong!")
task.wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("That isn't much of an argument. All you said was that he is wrong.")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
task.wait(3)
CameraChange:FireAllClients(workspace.CutscenePart6)
ChangeText:FireAllClients("The adventurer is probably bad at arguing. I say the adventurer posessed him with his own mind!")
ChangeImage:FireAllClients("rbxassetid://8130394889")
Nickname:FireAllClients("West (Cowboy 2)")
task.wait(3)
ChangeText:FireAllClients("Good argument! I find the defendant guilty!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
task.wait(3)
ReplicatedStorage.Screen.Parent = game.Lighting
task.wait(2)
ReplicatedStorage.RestartEvent:FireAllClients()
end)
ReplicatedStorage.ChooseEvent2.OnServerEvent:Connect(function()
print("Choice2")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("Last year you said the scientist was a wizard!")
task.wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("Good point!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
end)
ReplicatedStorage.ChooseEvent3.OnServerEvent:Connect(function()
print("Choice3")
CameraChange:FireAllClients(workspace.CutscenePart7)
ChangeText:FireAllClients("Agreed.")
task.wait(3)
CameraChange:FireAllClients(workspace.CutscenePart8)
ChangeText:FireAllClients("This is certainly a change of events! If your own defender disagrees, then you are proven guilty!")
ChangeImage:FireAllClients("rbxassetid://8231432568")
Nickname:FireAllClients("Judge")
task.wait(3)
ReplicatedStorage.Screen.Parent = game.Lighting
task.wait(2)
ReplicatedStorage.RestartEvent:FireAllClients()
end)
Can you provide the client-sided code responsible for firing the remotes?
Different local scripts in the text buttons:
–Choice1
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Choice1.Visible = false
script.Parent.Parent.Parent.Choice2.Visible = false
script.Parent.Parent.Parent.Choice3.Visible = false
game.ReplicatedStorage.ChooseEvent:FireServer()
end)