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

Why does the client replicate to a non-experimental server?

Asked by
Bisoph 5
6 years ago

I'm making an adventure game, and I made a button that lifts a certain object in the client. To make sure it only happens to the client, I disabled experimental mode. When I test it in a local server, something weird happens: when the client lifts the object, the server also lifts the object. I don't know why this is happening. I'm pretty sure it's not my fault.

Server code:

local ReplicatedStorage = game.ReplicatedStorage

local playersActivated = {}


script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    print(playersActivated[player])
    if player and playersActivated[player] == nil then
        playersActivated[player] = player
        ReplicatedStorage.ClientManipulation.TweenObject:InvokeClient(player, 
            workspace.CageRod,
            workspace.CageRod.CFrame + Vector3.new(0, 10, 0),
            3)
        ReplicatedStorage.ClientManipulation.TweenObject:InvokeClient(player, script.Parent, script.Parent.CFrame - Vector3.new(0, 0.5, 0), 0.5)
        wait(0.5)
        ReplicatedStorage.ClientManipulation.TweenCamera:InvokeClient(player,
            CFrame.new(73.3383026, 14.7632408, -39.4837646, 0.998810053, 0.0133609381, -0.0469054841, 9.31322686e-10, 0.961743772, 0.273950845, 0.0487712994, -0.273624867, 0.960599184),
            CFrame.new(74.327774, 6.49960041, -62.8328209, 0.998810828, 0.0186573416, -0.0450439118, -0, 0.923882961, 0.38267538, 0.0487550087, -0.382220298, 0.92278415),
            3)
    end
end)

Client code:

local functionFolder = game:GetService('ReplicatedStorage'):WaitForChild('ClientManipulation')
local player = game.Players.LocalPlayer

functionFolder:WaitForChild('TweenCamera').OnClientInvoke = function(startPos, endPos, time)
    local walkSpeed, jumpPower = 16, 50
    if player.Character then
        walkSpeed, jumpPower = player.Character:WaitForChild('Humanoid').WalkSpeed, player.Character:WaitForChild('Humanoid').JumpPower
        player.Character:WaitForChild('Humanoid').WalkSpeed = 0
        player.Character.Humanoid.JumpPower = 0
    end
    local camera = workspace.CurrentCamera
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CameraSubject = nil
    camera.CFrame = startPos
    game:GetService('TweenService'):Create(camera, TweenInfo.new(time), { CFrame = endPos }):Play()
    wait(time)
    camera.CameraType = Enum.CameraType.Custom
    while not player.Character do wait() end
    camera.CameraSubject = player.Character:WaitForChild('Humanoid')
    player.Character.Humanoid.WalkSpeed = walkSpeed
    player.Character.Humanoid.JumpPower = jumpPower
end

functionFolder:WaitForChild('TweenObject').OnClientInvoke = function(obj, endPos, time)
    game:GetService('TweenService'):Create(obj, TweenInfo.new(time), { CFrame = endPos }):Play()
end

Please, if you know the solution to this, post it below.

1 answer

Log in to vote
0
Answered by 6 years ago

It's cause you were testing it in studio. Try the network function thingy, I can't remember what it's called because I'm not currently in studio. You can also try team test. Both work.

0
You even say you were testing in a local server. DaWarTekWizard 169 — 6y
Ad

Answer this question