Hi all, I’m creating a dialogue script that moves my body away and makes the camera face the NPC I’m talking to. (Right now I’m testing with an NPC named Hacker) To activate the dialogue after using a proximity prompt, I used a remote event fired to the client, but it isn’t being received with no errors at all.
Output:
16:54:23.112 [REDACTED]
16:54:43.416 Fired - Server - TalkScript:21
Script:
local prompt = script.Parent
local hacktalk = false
local badgeservice = game:GetService("BadgeService")
local hacktalkPlayerPos = game.Workspace.HackerBadgeThingy.Position
local hacktalkCameraPos = game.Workspace.HackerTalkCam.Position
local camFocus = game.Workspace.Hacker:WaitForChild("Head").Position
prompt.Triggered:Connect(function(plr)
hacktalk = true
local dialogue = {"Hey, what are you doing here?",
"...",
"...You shouldn't be up here.",
"I think you're expecting the Hacker badge. Aren't you?",
"You must be those type of players who use hacks just to get what they want.",
"Or, you're using a tutorial to help you.",
"You know what, I don't care. Take it, and leave me alone.",
"But you've done something terribly wrong.",
"I hope you understand that.",
'game:GetService("BadgeService"):AwardBadge(' .. tostring(plr.UserId) .. ', 2124984212)'}
game.ReplicatedStorage.Talk:FireClient(plr, dialogue, "Hacker", hacktalkPlayerPos, hacktalkCameraPos, camFocus)
print("Fired")
end)
game.ReplicatedStorage.AwardBadgefromTalk.OnServerEvent:Connect(function(player, badgeID)
if hacktalk == true then
hacktalk = false
local success, returned = pcall(function()
return badgeservice:GetBadgeInfoAsync(2124984212)
end)
if success then
local badgeEnabled = returned.IsEnabled
if badgeEnabled then
local success2, returned2 = pcall(function()
return badgeservice:UserHasBadgeAsync(player.UserId, 2124984212)
end)
if success2 then
if returned2 == false then
badgeservice:AwardBadge(player.UserId, 2124984212)
end
end
end
end
hacktalk = true
end
end)
Local script:
local repstorage = game:GetService("ReplicatedStorage")
local text = script.Parent.Text
local speker = script.Parent.Speaker
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local currentCam = game.Workspace.CurrentCamera
local torso = char:WaitForChild("Torso")
repstorage:FindFirstChild("Talk").OnClientEvent:Connect(function(dialogue, speaker, bodyPos, camPos, camFocus)
print("Received")
torso.Position = bodyPos
torso.Anchored = true
currentCam.CameraType = Enum.CameraType.Scriptable
currentCam.CFrame = CFrame.new(camPos)
currentCam.Focus = CFrame.new(camFocus)
script.Parent.Visible = true
speker.Text = speaker
for j, v in ipairs(dialogue) do
local stringlength = string.len(v)
for i = 1, stringlength do
text.MaxVisibleGraphemes = i
text.Text = v
task.wait(0.05)
end
task.wait(3)
end
repstorage.AwardBadgefromTalk:FireServer(2124984212)
currentCam.CameraType = Enum.CameraType.Custom
torso.Anchored = false
script.Parent.Visible = false
end)
For some strange reason it was received on the client before I added bodyPos, camPos, and camFocus.