GetMarkerReachedSignal not working [SOLVED]

I used Moon Animator to make an animation and two events for it. Both don’t respond when calling GetMarkerReachedSignal.

Keyframes for the animations are stored in a dummy which I used for animating. The animation instance is in the workspace with the right ID attached.

image

image

What I’m interested in:

sculptAnim:GetMarkerReachedSignal("HitClimax"):Connect(function()
    print("hi")
end)
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local re = RS.ProxRemote
local SG = game:GetService("StarterGui")
local player = game.Players.LocalPlayer or game.Players.PlayerAdded
local playerGUI = player.PlayerGui
local GUI = playerGUI:WaitForChild("ScreenGui")
local closeButton = GUI.CloseButton

local ClaySmashSound = workspace["Clay Smash SFX"]


local inputConnection -- variable to store input connection
local merchant = workspace.Merchant

local Camera = workspace.Camera
local sculptDesk = workspace.SculptingDeskMain_BoxSkin
local proxButtonDesk = sculptDesk.ProximityPrompt

local XPMod = require(RS.Modules.XPDistribution)
local XPModRemote = RS.XPModRemote

local sculptAnim1 = workspace.SculptingAnimationFinalEvent

local TweenService = game:GetService("TweenService")
local SculptVarMOD = require(RS.Modules.SculptVariations)


local sculptProgress_MAX = 0
local currentProgress = 0
local increment = 50
local sculptDebounce = false
local sculpt_CD = 1.5

local isSculpting = false

local humanoid = player.Character:WaitForChild("Humanoid")
local sculptAnim = humanoid:LoadAnimation(sculptAnim1)

local getControls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()

local function speedUpgradeReceived(speedUpgr)
	increment = increment + speedUpgr
	print("Upgrade lvl2 received, " .. increment)
end

local function AssignRandomSculpt(num)
	local finalRandomSculpt = SculptVarMOD:GetRandomSculpt(player)
	print(finalRandomSculpt.MaxHits)

	sculptProgress_MAX = finalRandomSculpt.MaxHits
	return sculptProgress_MAX
end




local function Sculpting(finalRandomSculpt)
	if not isSculpting then
		sculptProgress_MAX = AssignRandomSculpt(sculptProgress_MAX)
	end
	
	isSculpting = true
	
	
	
	
	inputConnection = UIS.InputBegan:Connect(function(input, gameProcessedEvent)
		proxButtonDesk.Enabled = false
		
		if input.UserInputType == Enum.UserInputType.MouseButton1 and currentProgress < sculptProgress_MAX then
			
			if gameProcessedEvent == false and not sculptDebounce then
				sculptDebounce = true
				
				
				
				
				sculptAnim:Play()
				sculptAnim:AdjustSpeed(1)
				
				sculptAnim:GetMarkerReachedSignal("HitClimax"):Connect(function()
					print("hi")
				end)
				
				task.wait(.7)
				ClaySmashSound:Play()
				currentProgress += increment
				print(currentProgress)
				
				
				if currentProgress >= sculptProgress_MAX then
					local finishedSculpt = RS.Sculpt:Clone()
					finishedSculpt.Parent = player.Backpack
					XPModRemote:FireServer(true)
					print("sculpt is ready")

					currentProgress = 0
					getControls:Enable()
					closeButton.Visible = false
					inputConnection:Disconnect()
					
					Camera.CFrame = CFrame.Angles(5, 5, 0)
					Camera.CameraType = Enum.CameraType.Custom
					isSculpting = false
					sculptAnim:Stop()
					task.wait(.5)
					proxButtonDesk.Enabled = true
				end
				
				task.wait(sculpt_CD)
				sculptDebounce = false
			end
			
			
			
		
			while isSculpting do
				if humanoid.Health <= 0 then
					
					isSculpting = false
					currentProgress = 0
					getControls:Enable()
					closeButton.Visible = false
					inputConnection:Disconnect()
					Camera.CFrame = CFrame.Angles(5, 5, 0)
					Camera.CameraType = Enum.CameraType.Custom
					print("Player died during sculpting, resetting state")
					task.wait(4)
					proxButtonDesk.Enabled = true
					break
				end
				wait(0.1) 
			end
		
		end
	end)
end

local function EnableDisableMovement()
	
	getControls:Disable()
	closeButton.Visible = true
	Sculpting()
	
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = sculptDesk.CFrame * CFrame.new(0, 3, 0) * CFrame.Angles(0, math.rad(90), 0)
	player.Character:WaitForChild("Humanoid").RootPart.CFrame = sculptDesk.CFrame * CFrame.new(-5, 0, 0) * CFrame.Angles(0, math.rad(-90), 0)
	
	-- Connect the MouseButton1Click event handler
	closeButton.MouseButton1Click:Connect(function()
		
		getControls:Enable()
		closeButton.Visible = false
		proxButtonDesk.Enabled = true
		
		Camera.CFrame = CFrame.Angles(5, 5, 0)
		Camera.CameraType = Enum.CameraType.Custom
		if inputConnection then
			inputConnection:Disconnect() 
		end
		
	end)
end

local function sellingSculpttoMerchant()
	
	local sculpt = player.Backpack:FindFirstChild("Sculpt")
	
	if sculpt then
		sculpt:Destroy()
		RS.MerchantGold:FireServer()
		print("has item")
		
	else
		
		print("ur a failure")
		end
		--RS.MerchantGold:FireServer()
end


proxButtonDesk.Triggered:Connect(function(player)
	EnableDisableMovement()
	
end)


merchant.SellProx.Triggered:Connect(sellingSculpttoMerchant)

RS.SculptSpeedBought.OnClientEvent:Connect(speedUpgradeReceived)





2 Likes

Found a fix. Apparently, the initial name of the event in the Moon Animator is just cosmetic and only for your convenience. For events to actually work, you have to click on this bar on the left and add a name and parameter (if needed).

So, "HitClimax" is just a cosmetic, while "Hit" and param will get caught by GetMarkerReachedSignal.

moon_fix

sculptAnim:GetMarkerReachedSignal("Hit"):Connect(function(param)
					print(param)
					print("hi")
				end)

Output:
image

Confirming it works as intended (changing animation speed; sound plays exactly on the event keyframe each time):

Default Animation Speed

sculptAnim:Play()
				sculptAnim:AdjustSpeed(1)
				
				sculptAnim:GetMarkerReachedSignal("Hit"):Connect(function(param)
					print(param)
					print("hi")
					ClaySmashSound:Play()
				end)

0.3 Animation Speed

sculptAnim:Play()
				sculptAnim:AdjustSpeed(.3)
				
				sculptAnim:GetMarkerReachedSignal("Hit"):Connect(function(param)
					print(param)
					print("hi")
					ClaySmashSound:Play()
				end)
5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.