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

Shake gui not working correctly? How to clone to all players?

Asked by 4 years ago

I wanted to make a gui that parents a script from replicated to everyone. Basically it is a shake all cam gui for a project i'm working on.

I have no idea why it isn't working?

local epicmoment = game.Players:GetPlayers()



script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.Shake:Clone().Parent = game.StarterPlayer.StarterCharacterScripts
    game.ReplicatedStorage.Shake:Clone().Parent = game.StarterPlayer.StarterPlayerScripts
    game.ReplicatedStorage.Shake:Clone().Parent = game.Players:GetPlayers().PlayerScripts
end)

And the script im trying to clone is

local function Shake_Cam_Event_sub()
    local x = math.random(-100,100)/100
    local y = math.random(-100,100)/100
    local z = math.random(-100,100)/100
    local step_int = 1
    for counter_a = 10, 0, -1 do
        step_int = step_int * -1
        local shift_int = counter_a/10 * step_int
        local xx = x*shift_int
        local yy = y*shift_int
        local zz = z*shift_int
        Humanoid.CameraOffset = Vector3.new(xx,yy,zz)
        wait(0.01)
    end
end

Basically when I click a gui button it should clone right? It clones for both StarterChar and StarterPlayer but not for PlayerScripts. I am not sure where to parent the shake script, so I just tried to parent it to every script area accessible by clients. It also underlines Humanoid in yellow. How do I fix this?

Answer this question