You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
For my code to play sound effects and to fix this camera bug -
What is the issue? Include screenshots / videos if possible!
Watch Recording 2024-07-04 175107 | Streamable -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have and I have asked for help in discord servers such as “HiddenDevs”, however they came across as very rude and unhelpful.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
As seen in the video, cameraparts are meant to sync each time the npc hits his head. However, towards the end a camerapart shows but is then suddenly skipped. Sound is also meant to play each time the NPC hits his head. In my code there is a table that is meant to run the sounds but it does not run.
local animation = game.Workspace.thornaty.Script:WaitForChild('Animation')
local ow = game.Workspace.thornaty.Script:WaitForChild('Ouch')
local humanoid = game.Workspace.thornaty:WaitForChild('Humanoid')
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
warn("Animator not found on humanoid")
return
end
local dance = animator:LoadAnimation(animation)
local oof = animator:LoadAnimation(ow)
-- Setting the priority of the animations
dance.Priority = Enum.AnimationPriority.Action3
oof.Priority = Enum.AnimationPriority.Action4
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local ShakeModule = require(game:GetService("ReplicatedStorage").CameraShaker)
local localPlayer = game.Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local runService = game:GetService("RunService")
local screenGui = Instance.new("ScreenGui")
local container = workspace.Dialogue.Brick
local zone = Zone.new(container)
local debounce = false -- When its touched it can't be activated again
local Messages = {"Watching all these people being brutally being pushed in this pit makes me nervous to be sat here."} -- Message 1
local Messages2 = {"..."}
local Messages3 = {"...But you wouldn't hurt me... right?"}
local Messages4 = {"..."}
local Messages5 = {"AYAYAYAYAYAAAAAA!!!!"}
local camera = game.Workspace.CurrentCamera
local camerapart = game.Workspace.CameraPart
local CP2 = game.Workspace.CameraPart2
local CP3 = game.Workspace.CameraPart3
local CP4 = game.Workspace.CameraPart4
local CP5 = game.Workspace.CameraPart5
local CP6 = game.Workspace.CameraPart6
local CP7 = game.Workspace.CameraPart7
local Time = 1
local Repeat = 0
local boom = game.Workspace.Dialogue.Brick.BOOM
local punch = game.Workspace.Dialogue.Brick.Punch
local TweenService = game:GetService("TweenService")
zone.localPlayerEntered:Connect(function(plr)
if not debounce then
debounce = true
local GUI = game.Workspace.Dialogue.Brick.NpcDialogue:Clone()
local LEAVE = GUI.Background.LEAVE
local PUSH = GUI.Background.PUSH
GUI.Parent = localPlayer.PlayerGui
camera.CameraType = Enum.CameraType.Scriptable
local Tween = TweenInfo.new(Time, Enum.EasingStyle.Quad, Enum.EasingDirection.In, Repeat)
local properties = {CFrame = camerapart.CFrame}
local Anim = TweenService:Create(camera, Tween, properties)
Anim:Play()
local function displayMessages(messages)
for _, v in ipairs(messages) do
for i = 1, #v do
wait(0.035)
GUI.Background.DialogueText.Text = string.sub(v, 1, i)
end
wait(2)
end
end
displayMessages(Messages)
displayMessages(Messages2)
displayMessages(Messages3)
LEAVE.Visible = true
PUSH.Visible = true
PUSH.MouseButton1Click:Connect(function()
LEAVE.Visible = false
PUSH.Visible = false
displayMessages(Messages2)
displayMessages(Messages5)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CP2.CFrame
punch:Play()
dance:Stop()
oof:Play()
oof:AdjustSpeed(0.5) -- Call AdjustSpeed after starting the animation
local keyframeActions = {
[CP3.CFrame] = function()
print("Playing boom at CP3")
boom:Play()
end,
[CP4.CFrame] = function()
print("Playing boom at CP4")
boom:Play()
end,
[CP5.CFrame] = function()
print("Playing boom at CP5")
boom:Play()
end,
[CP6.CFrame] = function()
print("Playing boom at CP6")
boom:Play()
end,
[CP7.CFrame] = function()
print("Playing boom at CP7")
boom:Play()
end,
}
local keyframeIndex = 1
local keyframes = {CP3.CFrame, CP4.CFrame, CP5.CFrame, CP6.CFrame, CP7.CFrame}
oof.KeyframeReached:Connect(function()
if keyframeIndex <= #keyframes then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = keyframes[keyframeIndex]
if keyframeActions[keyframes[keyframeIndex]] then
keyframeActions[keyframes[keyframeIndex]]()
end
keyframeIndex = keyframeIndex + 1
end
end)
end)
LEAVE.MouseButton1Click:Connect(function()
-- Define action for LEAVE button
end)
displayMessages(Messages4)
wait(3) -- Time before the Dialogue disappears
GUI.Background:TweenPosition(
UDim2.new(0.522, 0, 1.776, 0),
"In",
"Quad",
1, -- Time when the GUI tweens down
false
)
camera.CameraType = "Custom"
wait(3)
debounce = false
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.