#Remote Event does not work with Proximity prompt
15 messages · Page 1 of 1 (latest)
To fire server use a localscript
-- LocalScript
local part = script.Parent
local prompt = script.Parent.ProximityPrompt
local promptjob = game:GetService("ProximityPromptService")
prompt.Triggered:Connect(function()
game.ReplicatedStorage.cutsceneone:FireServer()
end)
To fire client use a normal script as Izan990 said (remember to define player):
-- Script
local part = script.Parent
local prompt = script.Parent.ProximityPrompt
local promptjob = game:GetService("ProximityPromptService")
prompt.Triggered:Connect(function()
game.ReplicatedStorage.cutsceneone:FireClient(player)
end)
Triggered pass the player
prompt.Triggered:Connect(function(player: Player)
game.ReplicatedStorage.cutsceneone:FireClient(player)
end)
You can use this for fancy formatting like my messages:
What error?
If you're catching the event in a server script you want to check for OnServerEvent.
What are you trying to do?
** You are now Level 1! **
You'll need 2 scripts for that, one on the server and one on the client.
The localscript script will look like this:
-- Localscript
local part = script.Parent
local prompt = script.Parent.ProximityPrompt
local promptjob = game:GetService("ProximityPromptService")
prompt.Triggered:Connect(function()
game.ReplicatedStorage.cutsceneone:FireServer()
end)
And the server script will look like this:
-- Script
game.ReplicatedStorage.cutsceneone.OnServerEvent:Connect(function(player)
print(player) -- Example of printing the player who used the proximity prompt.
end)
For the reverse you would use this in the server script:
-- Script
local part = script.Parent
local prompt = script.Parent.ProximityPrompt
local promptjob = game:GetService("ProximityPromptService")
prompt.Triggered:Connect(function(player)
game.ReplicatedStorage.cutsceneone:FireClient(player)
end)
And this in the localscript:
game.ReplicatedStorage.cutsceneone.OnClientEvent:Connect(function()
print(player) -- Example of printing the player who used the proximity prompt.
end)
Which one?
Could you show me the code you used and an image of the scripts in the explorer?