local re = script.Parent:WaitForChild("RemoteEvent") local Animation = script:WaitForChild("Animation") local an local Attacked = false local cooldown = 8 local Range = 100 local pause = function() an:AdjustSpeed(0)end function windBlast(player,actionName, userInputState, inputObject) local char = player.Character local hum = char.Humanoid if userInputState == Enum.UserInputState.Begin and Attacked == false then Attacked = true an = hum:LoadAnimation(Animation) an:AdjustSpeed(0.2) an:GetMarkerReachedSignal("In").Connect(pause) an:Play() elseif userInputState == Enum.UserInputState.End and Attacked == true then an:AdjustSpeed(1) wait(cooldown) Attacked = false end end re.OnServerEvent:connect(windBlast)
So basically i am getting an weird error its this part here an:GetMarkerReachedSignal("In").Connect(pause) the Parameter is a "Strings" and returns RBXScriptSignal
at first i thought it was the server script so i tried a localscript but still got the same error.
I am unsure whats happening here any sugestions?
The error is the dot instead of a colon in the Connect
call. If you want it to just work, replace it with a colon like this:
an:GetMarkerReachedSignal("In"):Connect(pause) -- ^
The colon operator is shorthand for calling a method of an object, with the object as the first argument. So these two statements are the same for any method:
Part.Touched:Connect(onTouched) Part.Touched.Connect(Part.Touched, onTouched)
A second error I'm assuming after that is AdjustSpeed is not a valid member of an
, because the definition of pause
happens before an
is set to a non-nil value. Maybe. But it's bad practice anyway, so what I'd recommend you to do is to just define the function in the :Connect()
call, like so:
an:GetMarkerReachedSignal("In"):Connect(function() an:AdjustSpeed(0) end)
Hope that helps!