• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


01 Dec, 2024

Updated at 14 Dec, 2024

Why is this remote event not working?

I’m attempting to create an NPC talking system which disables the player’s movement and passes dialogue from a server script parented to a proximityprompt. These variables contain strings that I want to use on the client side script to print dialogue, also parented to a proximityprompt. I’m using a remote event to send the variables

The issue is that when I’m firing the event to the client from the server script, the OnClientEvent event doesn’t do as it was told.

Server script:

local prompt = script.Parent
local event = game:GetService("ReplicatedStorage"):WaitForChild("NPCTalk")

local d1 = "dialogue1"
local d2 = "dialogue2"
local d3 = "dialogue3"

prompt.Triggered:Connect(function(plr)
	event:FireClient(plr, d1, d2, d3)
end)

Client script:

local players = game:GetService("Players")
local player = players.LocalPlayer
local event = game.ReplicatedStorage:WaitForChild("NPCTalk")

event.OnClientEvent:Connect(function(d1, d2, d3)
	player.Character.Humanoid.WalkSpeed = 0
	player.Character.Humanoid.JumpPower = 0
	print(d1, d2, d3)
end)

What seems to be the problem here?

1 post - 1 participant

Read full topic