You can’t get the triggered event from a local script. Only server script. So try firing a remote to the client when it is triggered. I am 100% sure this is the problem.
What should the remote event do?
When triggered fire the remote to the client to start the process.
I got an error saying: Argument 1 missing or nil
Server Scripter
-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local MarketPlaceService = game:GetService("MarketplaceService")
-- Prompt
local Prompt = workspace.PassportGiverHitbox.ProximityPrompt
-- OnTrigger
local RemoteEvent = script.Parent.OnTrigger
Prompt.Triggered:Connect(function()
RemoteEvent:FireClient()
end)
Local Script:
-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local MarketPlaceService = game:GetService("MarketplaceService")
-- Player
local Player = Players.LocalPlayer
local Char = Player.CharacterAdded:Wait() or Player.Character
-- Passport Dialogue Frame
local PassportDialogueFrame = script.Parent.PassportDialogue
-- Passport Dialogue Buttons
local PassportDialogueButtons = {PassportDialogueFrame.AcceptButton, PassportDialogueFrame.DeclineButton}
-- Click Sound
local ClickSound = script.Parent.ClickSound
-- Select Sound
local SelectSound = script.Parent.SelectSound
-- Remote
local Remote = script.Parent.OnTrigger
-- Tool
local Tool = script.Parent.Passport
local Question = "Would you like to get a passport?"
local Say2 = "Here you go..."
local Say3 = "Okay, bye..."
local QuestionLabel = PassportDialogueFrame.Question
Remote.OnClientEvent:Connect(function()
PassportDialogueFrame.Visible = true
for i = 1, #Question do
QuestionLabel.Text = string.sub(Question, 1, i)
end
repeat wait() until QuestionLabel.Text == Question
PassportDialogueFrame.AcceptButton.Visible = true
PassportDialogueFrame.DeclineButton.Visible = true
end)
PassportDialogueFrame.AcceptButton.MouseButton1Click:Connect(function()
if Player.Backpack:FindFirstChild("Passport") or Char:FindFirstChild("Passport") then
return
else
local NewTool = Tool:Clone()
NewTool.Parent = Player.Backpack
for i = 1, #Question do
QuestionLabel.Text = string.sub(Say3, 1, i)
end
end
repeat wait() until QuestionLabel.Text == Say2
PassportDialogueFrame.Visible = false
PassportDialogueFrame.AcceptButton.Visible = false
PassportDialogueFrame.DeclineButton.Visible = false
end)
PassportDialogueFrame.DeclineButton.MouseButton1Click:Connect(function()
for i = 1, #Question do
QuestionLabel.Text = string.sub(Say3, 1, i)
end
repeat wait() until QuestionLabel.Text == Say3
PassportDialogueFrame.Visible = false
PassportDialogueFrame.AcceptButton.Visible = false
PassportDialogueFrame.DeclineButton.Visible = false
end)
for _,Button in ipairs(PassportDialogueButtons) do
if not Button:IsA("TextButton") then continue end
local UICorner = Button:WaitForChild("UICorner")
local Square = TweenService:Create(UICorner,TweenInfo.new(0.1),{CornerRadius = UDim.new(0.05,0)})
local Circle = TweenService:Create(UICorner,TweenInfo.new(0.1),{CornerRadius = UDim.new(0.5,0)})
Circle:Play()
Button.MouseEnter:Connect(function()
if SelectSound.SoundId ~= nil then
SelectSound:Play()
end
Button.UIStroke.Enabled = true
Square:Play()
end)
Button.MouseLeave:Connect(function()
Button.UIStroke.Enabled = false
Circle:Play()
end)
Button.MouseButton1Click:Connect(function()
if ClickSound.SoundId ~= nil then
ClickSound:Play()
end
end)
end
you should define the player
Prompt.Triggered:Connect(function(plr)
RemoteEvent:FireClient(plr)
end)
-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local MarketPlaceService = game:GetService("MarketplaceService")
-- Prompt
local Prompt = workspace.PassportGiverHitbox.ProximityPrompt
-- OnTrigger
local RemoteEvent = script.Parent.OnTrigger
Prompt.Triggered:Connect(function(plr)
RemoteEvent:FireClient(plr)
end)
Didnt’ work. But with no erros
where are the serverscript & localscript are located?
In starter gui.
put the ServerScript in ServerScriptService.
or inside the proximityprompt.
and you can change the Prompt Variable to
local Prompt = script.Parent
Put the server script INSIDE the proximity prompt
And put the remote event inside replicated storage
can you add a print in here?
Prompt.Triggered:Connect(function(plr)
-- here
RemoteEvent:FireClient(plr)
end)
There is no chance that it doesn’t fire when inside the proximity prompt.
its the same if it was inside ServerScriptService or inside the ProximityPrompt.
I also said putting the remote event inside the replicated storage…
Bumping my reply. Have you tried this yet?
Again didn’t work…
Local Script:
-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Player
local Player = Players.LocalPlayer
local Char = Player.CharacterAdded:Wait() or Player.Character
-- Passport Dialogue Frame
local PassportDialogueFrame = script.Parent.PassportDialogue
-- Passport Dialogue Buttons
local PassportDialogueButtons = {PassportDialogueFrame.AcceptButton, PassportDialogueFrame.DeclineButton}
-- Click Sound
local ClickSound = script.Parent.ClickSound
-- Select Sound
local SelectSound = script.Parent.SelectSound
-- OnTrigger
local RemoteEvent = ReplicatedStorage.RemoteEvents.OnPassportGiverTrigger
-- Tool
local Tool = script.Parent.Passport
local Question = "Would you like to get a passport?"
local Say2 = "Here you go..."
local Say3 = "Okay, bye..."
local QuestionLabel = PassportDialogueFrame.Question
RemoteEvent.OnClientEvent:Connect(function()
PassportDialogueFrame.Visible = true
for i = 1, #Question do
QuestionLabel.Text = string.sub(Question, 1, i)
end
repeat wait() until QuestionLabel.Text == Question
PassportDialogueFrame.AcceptButton.Visible = true
PassportDialogueFrame.DeclineButton.Visible = true
end)
PassportDialogueFrame.AcceptButton.MouseButton1Click:Connect(function()
if Player.Backpack:FindFirstChild("Passport") or Char:FindFirstChild("Passport") then
return
else
local NewTool = Tool:Clone()
NewTool.Parent = Player.Backpack
for i = 1, #Question do
QuestionLabel.Text = string.sub(Say3, 1, i)
end
end
repeat wait() until QuestionLabel.Text == Say2
PassportDialogueFrame.Visible = false
PassportDialogueFrame.AcceptButton.Visible = false
PassportDialogueFrame.DeclineButton.Visible = false
end)
PassportDialogueFrame.DeclineButton.MouseButton1Click:Connect(function()
for i = 1, #Question do
QuestionLabel.Text = string.sub(Say3, 1, i)
end
repeat wait() until QuestionLabel.Text == Say3
PassportDialogueFrame.Visible = false
PassportDialogueFrame.AcceptButton.Visible = false
PassportDialogueFrame.DeclineButton.Visible = false
end)
for _,Button in ipairs(PassportDialogueButtons) do
if not Button:IsA("TextButton") then continue end
local UICorner = Button:WaitForChild("UICorner")
local Square = TweenService:Create(UICorner,TweenInfo.new(0.1),{CornerRadius = UDim.new(0.05,0)})
local Circle = TweenService:Create(UICorner,TweenInfo.new(0.1),{CornerRadius = UDim.new(0.5,0)})
Circle:Play()
Button.MouseEnter:Connect(function()
if SelectSound.SoundId ~= nil then
SelectSound:Play()
end
Button.UIStroke.Enabled = true
Square:Play()
end)
Button.MouseLeave:Connect(function()
Button.UIStroke.Enabled = false
Circle:Play()
end)
Button.MouseButton1Click:Connect(function()
if ClickSound.SoundId ~= nil then
ClickSound:Play()
end
end)
end
Server Script:
-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Prompt
local Prompt = script.Parent
-- OnTrigger
local RemoteEvent = ReplicatedStorage.RemoteEvents.OnPassportGiverTrigger
Prompt.Triggered:Connect(function(plr)
RemoteEvent:FireClient(plr)
end)
try to add a print inside the Triggered Function to see if its firing.
Also inside the local script. If it does print then its not the prompts problem.