-
What do you want to achieve? A beam ability
-
What is the issue? I keep getting this weird error that doesn’t relate to any of my scripts
Here’s the error:
RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Players.hopeshusbvnd.PlayerScripts.PlayerModule.CameraModule.TransparencyController:168: invalid argument #3 to 'clamp' (max must be greater than or equal to min)
- What solutions have you tried so far? haven’t tried any bc I don’t know what it is-
here’s the code that’s most likely causing it to error (since it doesn’t work as it should be and uses RunService.RenderStepped
-- services
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
-- beam + attachments
local MarvelBeam = ReplicatedStorage:FindFirstChild("MarvelBeam")
local beam1 = MarvelBeam.Beam1:Clone()
local beam0 = MarvelBeam.Beam0:Clone()
local attachment0 = MarvelBeam.Hand.Attachment0:Clone()
local attachment1 = MarvelBeam.End:Clone()
beam0.Parent = workspace.Terrain
beam1.Parent = workspace.Terrain
attachment0.Parent = workspace.Terrain
attachment1.Parent = workspace.Terrain
beam0.Attachment0 = attachment0
beam0.Attachment1 = attachment1.Attachment1
beam1.Attachment0 = attachment0
beam1.Attachment1 = attachment1.Attachment1
-- other variables
local player = game.Players.LocalPlayer
local character = player.Character
local XKeyPressed = false
local canBeam = true
local Animation = character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Animation"))
-- code
UserInputService.InputBegan:Connect(function(input, gameprocessed)
if input.KeyCode == Enum.KeyCode.X and canBeam then
XKeyPressed = true
character.CaptainMarvel:FindFirstChild("Q - EnergyBlast").Disabled = true
character.CaptainMarvel:FindFirstChild("R - ForceField").Disabled = true
Animation:Play()
character.Humanoid.WalkSpeed = 0
local mouse = player:GetMouse()
RunService.RenderStepped:Connect(function()
beam0.Enabled = true
beam1.Enabled = true
local hand = character.RightHand
local origin = hand.Position
local finish = mouse.Hit.p
attachment0.Position = origin
attachment1.Position = finish
end)
end
UserInputService.InputEnded:Connect(function(input, gameprocessed)
if input.KeyCode == Enum.KeyCode.X then
XKeyPressed = false
character.CaptainMarvel:FindFirstChild("Q - EnergyBlast").Disabled = false
character.CaptainMarvel:FindFirstChild("R - ForceField").Disabled = false
attachment0:Destroy()
attachment1:Destroy()
beam0:Destroy()
beam1:Destroy()
character.Humanoid.WalkSpeed = 16
canBeam = false
wait(1)
canBeam = true
end
end)
end)