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

Shake script works in Studio but not on a published game, how do I fix this?

Asked by
Nidoxs 190
9 years ago

Shake script works in Studio but not on a published game, how do I fix this? Do I put it in a local script or? Also how would I make it so only the players in the area(inside of the non-collidable brick)are the players who are affected by the camera shake.

Could I use : while true do repeat to check if there are players inside the brick? Then the function is pulled of? HELP! D:

function onClicked()
local camera = game.Workspace.CurrentCamera

local c = 1.5
wait(1.2)
for i = 1,10 do 

wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c*2,0,1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(c,0,0)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c,c,-c)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(c,c,0)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c,0,c)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0,-c,0)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c,c,-c)       
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(.1,-.1,c)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-.1,0,-.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c,.1,-.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-.1,c,.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(.1,-.1,.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(c,0,-c)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-.1,.1,-.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(c,.1,-c)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(c,-.1,.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-.1,0,-.1)
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(.1,0,-.1)
wait() 
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-c,0,c)

c = c / 1.5 
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)



2
You can only access the CurrentCamera from a LocalScript. Spongocardo 1991 — 9y
0
Hmm. I won't do that. How would I access the players camera? Much appreciated, Nidoxs 190 — 9y
2
Use a LocalScript. woodengop 1134 — 9y
0
I used it but it won't work, Nidoxs 190 — 9y
1
Localscripts only run in the player's Character or PlayerGui. iaz3 190 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Use a Local Script.

Ad

Answer this question