Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

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

Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
2 years ago
Edited 2 years ago

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)
0
ive tried it and it breaks the "part.touched:Connect:(touchedPart)" naimjack 0 — 2y
0
give the entire script? SuperPuiu 497 — 2y
0
part.touched:Connect:(touchedPart) was breaking because it wasn't written correctly. Change it to part.touched:Connect(touchedPart) SuperPuiu 497 — 2y
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" naimjack 0 — 2y
0
touchedPart doesn't exist. You must rewrite the entire script because it has many errors. SuperPuiu 497 — 2y
Ad

Answer this question