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

How to make a script occur only to the players client/occur locally?

So I have a bunch of lerps and stuff and they're only activated at a certain time. Although when it activates, it activates for everyone. I want the lerps to only activate to the player locally, so only the player can see the moving parts. Also, this script is a regular script. Tell me if it needs to be a local script.

Here's the script. I want to know how to make the whole script activate locally.

local part = script.Parent.Lip
local rlid1 = script.Parent.RightEyeLid1
local rlid2 = script.Parent.RightEyeLid2
local llid1 = script.Parent.LeftEyeLid1
local llid2 = script.Parent.LeftEyeLid2
local laughface = script.Parent
local laughsmile = script.Parent.Smile
local laughjaw = script.Parent.Jaw
local laughteeth1 = script.Parent.Teeth
local laughteeth2 = script.Parent.Jaw.Teeth
local laugheyes = script.Parent.TVEyes
local rightjaw = workspace.RightJaw
local leftjaw = workspace.LeftJaw


local start = part.CFrame * CFrame.new(0, 0, 0)
local finish = part.CFrame * CFrame.new(0, -5, 0)

local rlstart1 = rlid1.CFrame * CFrame.new(0, 0, 0)
local rlfinish1 = rlid1.CFrame * CFrame.new(0.65, 0, 0)

local rlstart2 = rlid2.CFrame * CFrame.new(0, 0, 0)
local rlfinish2 = rlid2.CFrame * CFrame.new(1.2, 0, 0)

local llstart1 = llid1.CFrame * CFrame.new(0, 0, 0)
local llfinish1 = llid1.CFrame * CFrame.new(-0.65, 0, 0)

local llstart2 = llid2.CFrame * CFrame.new(0, 0, 0)
local llfinish2 = llid2.CFrame * CFrame.new(-1.2, 0, 0)

local startlaugh = laughface.CFrame * CFrame.new(0,0,0)
local finishlaugh = laughface.CFrame * CFrame.new(0,0,2)

local startlaughsm = laughsmile.CFrame * CFrame.new(0,0,0)
local finishlaughsm = laughsmile.CFrame * CFrame.new(0,0,2)

local startlaughj = laughjaw.CFrame * CFrame.new(0,0,0)
local finishlaughj = laughjaw.CFrame * CFrame.new(0,0,2)

local startlaught1 = laughteeth1.CFrame * CFrame.new(0,0,0)
local finishlaught1 = laughteeth1.CFrame * CFrame.new(0,0,2)

local startlaught2 = laughteeth2.CFrame * CFrame.new(0,0,0)
local finishlaught2 = laughteeth2.CFrame * CFrame.new(0,0,2)

local startlaughe = laugheyes.CFrame * CFrame.new(0,0,0)
local finishlaughe = laugheyes.CFrame * CFrame.new(0,0,2)

local laughfacemoves = laughface.CFrame * CFrame.new(0,0,4)
local laughfacemovef = laughface.CFrame * CFrame.new(0,0.5,4)

local laughsmiles = laughsmile.CFrame * CFrame.new(0,0,4)
local laughsmilef = laughsmile.CFrame * CFrame.new(0,0.5,4)

local laugheyess = laugheyes.CFrame * CFrame.new(0,0,4)
local laugheyesf = laugheyes.CFrame * CFrame.new(0,0.5,4)

local laughteeths = laughteeth1.CFrame * CFrame.new(0,0,4)
local laughteethf = laughteeth1.CFrame * CFrame.new(0,-0.5,4)

local laughjaws = laughjaw.CFrame * CFrame.new(0,-1,4)
local laughjawf = laughjaw.CFrame * CFrame.new(0,-2,4)

local laughteethbs = laughteeth2.CFrame * CFrame.new(0,-1.5,4)
local laughteethbf = laughteeth2.CFrame * CFrame.new(0,-2,4)



wait(2)


script.Parent.TVEyes.Transparency = 0
script.Parent.Sounds.Amal:Play()
for time = 0, 1, 0.13 do
    local progress = 1 - math.cos(time * math.pi)
    rlid1.CFrame = rlstart1:lerp(rlfinish1, progress)
    rlid2.CFrame = rlstart2:lerp(rlfinish2, progress)
    llid1.CFrame = llstart1:lerp(llfinish1, progress)
    llid2.CFrame = llstart2:lerp(llfinish2, progress)
    wait()
end





wait(1)
script.Parent.Sounds.Amal.Pitch=0.7
script.Parent.Sounds.Amal:Play()
for time = 0, 1, 0.08 do
    local progress = 1 - math.cos(time * math.pi)
    part.CFrame = start:lerp(finish, progress)

    wait()
end
part.Transparency=1
wait(2)

for time = 0, 1, 0.3 do
    local progress = 1 - math.cos(time * math.pi)
    laughface.CFrame = startlaugh:lerp(finishlaugh, progress)
    laughsmile.CFrame = startlaughsm:lerp(finishlaughsm, progress)
    laughjaw.CFrame = startlaughj:lerp(finishlaughj, progress)
    laughteeth1.CFrame = startlaught1:lerp(finishlaught1, progress)
    laughteeth2.CFrame = startlaught2:lerp(finishlaught2, progress)
    laugheyes.CFrame = startlaught1:lerp(finishlaught1, progress)
    laugheyes.CFrame = startlaughe:lerp(finishlaughe, progress)

    wait()
end

script.Parent.Sounds.Laugh:Play()
wait(0.1)
rightjaw:Destroy()
leftjaw:Destroy()
game.ReplicatedStorage.RightJawLaugh:Clone().Parent = workspace
game.ReplicatedStorage.LeftJawLaugh:Clone().Parent = workspace

for time = 1, 64, 0.4 do
    local progress = 1 - math.cos(time * math.pi)
    laughface.CFrame = laughfacemoves:lerp(laughfacemovef, progress)
    laughsmile.CFrame = laughsmiles:lerp(laughsmilef, progress)
    laugheyes.CFrame = laugheyess:lerp(laugheyesf, progress)
    laughteeth1.CFrame = laughteeths:lerp(laughteethf, progress)
    laughjaw.CFrame = laughjaws:lerp(laughjawf, progress)
    laughteeth2.CFrame = laughteethbs:lerp(laughteethbf, progress)     
    wait()
end
workspace.RightJawLaugh:Destroy()
workspace.LeftJawLaugh:Destroy()
game.ReplicatedStorage.RightJaw:Clone().Parent = workspace
game.ReplicatedStorage.LeftJaw:Clone().Parent = workspace


wait(1)
part.Transparency=1
rlid1.Transparency=1
rlid2.Transparency=1
llid1.Transparency=1 
llid2.Transparency=1 
laughface.Transparency=1 
laughsmile.Transparency=1 
laughjaw.Transparency=1 
laughteeth1.Transparency=1
laughteeth2.Transparency=1
laugheyes.Transparency=1


1 answer

✓ Accepted answer

First off, you do need to change it to a localscript. This will make the next step possible.

Turn on FilteringEnabled in workspace

This will restrict all localscript actions to the client, making it show only on the player, and not the server.

More info:http://wiki.roblox.com/index.php?title=Client-Server_Model_and_FilteringEnabled

4 comments

0

Also, where would I put the localscript?

0

Nevermind, figured out. Thanks!

0

Threre is a problem, it still happens for everyone

0

lmao nevermind, I'm just really dumb. It works

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