Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Roblox Camera Shake "End" Problem. How do i fix it?

Im trying to make a part where when touched it will make your camera shake (also im using https://www.roblox.com/library/1461025953/Camera-Shaker because i was kinda lazy) the place where it has a red line is:

if not touched then touched = true camShake:Shake(CameraShaker.Presets.Explosion) end end

the bolded end is the problem here. What do i do now?

wait()

local part = workspace.SHAKE

local camera=workspace.CurrentCamera

local CameraShaker = require(game.ReplicatedStorage.CameraShaker)

local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
	camera.CFrame = camera.CFrame * shakeCFrame
end)

camShake:Start()

local touched = false

if not touched then
	  touched = true
	  camShake:Shake(CameraShaker.Presets.Explosion)
    end
end

 

part.touched:Connect:(touchedPart)

1 answer

I don't know if I'm right, but you added an end that is for nothing.

wait()

local part = workspace.SHAKE

local camera=workspace.CurrentCamera

local CameraShaker = require(game.ReplicatedStorage.CameraShaker)

local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
    camera.CFrame = camera.CFrame * shakeCFrame
end)

camShake:Start()

local touched = false

if not touched then
      touched = true
      camShake:Shake(CameraShaker.Presets.Explosion)
    end
-- end <--- here



part.touched:Connect:(touchedPart)

Edit: part.touched:Connect:(touchedPart) was breaking because it was written like that:

part.touched:Connect:(touchedPart)

And it must be changed to this:

part.touched:Connect(touchedPart)

5 comments

0

ive tried it and it breaks the "part.touched:Connect:(touchedPart)"

0

give the entire script?

0

part.touched:Connect:(touchedPart) was breaking because it wasn't written correctly. Change it to part.touched:Connect(touchedPart)

0

Tried changing the "part touched" to that. Comes up with this error in the output. " ? attempt to call a nil value (x22) " and "Attempt to connect failed: Passed value is not a function"

0

touchedPart doesn't exist. You must rewrite the entire script because it has many errors.

This discussion is preserved as it was. New answers, comments, and votes are closed.