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

Why is there desync in my RemoteEvent?

Asked by 4 years ago
Edited 4 years ago

Edit: I switched over to a Tool and everything is functioning identically to the HopperBin I used, still broken.

Here is a gif of the desync I'm experiencing in a Test Server: https://gyazo.com/4e02b51e729ec2da0bc9895e4688ef69

Here is what is SUPPOSED to happen (tested on Play-Mode not Test Server): https://gyazo.com/bef50cd830af882fe469da25a7855997

Somehow they both see the other person move, but not themselves. Everything else is working fine though. Kinda new to using RemoteEvents and all the FilteringEnabled stuff so I'm really confused, even after reading the wiki.

LocalScript for Players HopperBin Tool:

debounce = false
Selected = false
ComboActive = script:WaitForChild("ComboActive") --BoolValue in Script
-----------------------------------------------------------------------
player = game.Players.LocalPlayer
Char = player.Character or player.CharacterAdded:wait()
Hum = Char:WaitForChild("Humanoid")
RArm = Char:WaitForChild("Right Arm")
LArm = Char:WaitForChild("Left Arm")
RLeg = Char:WaitForChild("Right Leg")
LLeg = Char:WaitForChild("Left Leg")
Torso = Char:WaitForChild("Torso")
Head = Char:WaitForChild("Head")
RShoulder = Torso:WaitForChild("Right Shoulder")
LShoulder = Torso:WaitForChild("Left Shoulder")
RHip = Torso:WaitForChild("Right Hip")
LHip = Torso:WaitForChild("Left Hip")
Anim = Char:WaitForChild("Animate")
Mows = player:GetMouse()
-----------------------------------------------------------------------
ReplicatedStorage = game:GetService("ReplicatedStorage")
event_BoneCrush = ReplicatedStorage:WaitForChild("BoneCrushEvent")


script.Parent.Selected:connect(function()
    Selected = true
    if (debounce == false) then Mows.Icon = "rbxasset://textures\\GunCursor.png" end
    if (debounce == true) then Mows.Icon = "rbxasset://textures\\GunWaitCursor.png" end
    Mows.Button1Down:connect(function()
        if debounce == true then return end
        if Hum.Health <= 0 then return end
        if Head == nil or Hum == nil or RArm == nil or LArm == nil or RLeg == nil or LLeg == nil or Torso == nil then return end
        debounce = true
        Mows.Icon = "rbxasset://textures\\GunWaitCursor.png"
        event_BoneCrush:FireServer(ComboActive)
        wait(2)
        while ComboActive.Value == true do
            wait(0.1)
        end
        wait(0)
        debounce = false
        if Selected then Mows.Icon = "rbxasset://textures\\GunCursor.png" end
        debounce = false
    end)
end)

script.Parent.Deselected:connect(function()
    --Mows.Icon = 
    Selected = false
end)

Script in Workspace:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local event_BoneCrush = Instance.new("RemoteEvent", ReplicatedStorage)
event_BoneCrush.Name = "BoneCrushEvent"
local function onBoneCrush(Player,ToolActive)
    print(Player.Name, "starts Bone Crush")
    local Char = Player.Character or Player.CharacterAdded:wait()
    local Hum = Char:WaitForChild("Humanoid")
    local RArm = Char:WaitForChild("Right Arm")
    local Torso = Char:WaitForChild("Torso")
    local RShoulder = Torso:WaitForChild("Right Shoulder")
    local Anim = Char:WaitForChild("Animate")
    Anim.Disabled = true
    local ActiveTracks = Hum:GetPlayingAnimationTracks()
    for _,v in pairs(ActiveTracks) do
        v:Stop()
    end
    RShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0) * CFrame.fromEulerAnglesXYZ(0,0,1.5)
    wait(0.5)
    local Combo_Debounce = false
    ToolActive.Value = false
    local Combo_Touch = RArm.Touched:connect(function(hit)
        if Combo_Debounce == true then return end
        if hit.Parent == nil or hit.Parent == Char then return end
        local Hit_Hum = hit.Parent:findFirstChild("Humanoid")
        local Hit_Torso = hit.Parent:findFirstChild("Torso")
        if Hit_Hum == nil then return end
        if Hit_Torso == nil then return end
        ToolActive.Value = true
        Combo_Debounce = true
        wait(0.05)
        Hit_Torso.CFrame = RArm.CFrame + Vector3.new(0,0,0)
        Hit_Torso.Anchored = true
        Torso.Anchored = true
        wait(1)
        Hit_Torso.Anchored = false
        Torso.Anchored = false
        Hit_Torso.CFrame = Hit_Torso.CFrame + Vector3.new(0,100,0)
        Torso.CFrame = Torso.CFrame + Vector3.new(0,102,0)
        wait(0.1)
        Hit_Torso.Anchored = true
        Torso.Anchored = true
        wait(0.2)
        for i = 0.1 ,0.9, 0.1 do
            RArm.Reflectance = i
            wait(0.1)
        end
        RArm.Reflectance = 0
        wait(1)
        Torso.Anchored = false
        Hit_Torso.Anchored = false
        Hit_Torso.Velocity = Vector3.new(Hit_Torso.Velocity.x,-550,Hit_Torso.Velocity.z)
        Hit_Hum.Health = Hit_Hum.Health - 40
        ToolActive.Value = false
    end)
    wait(2)
    while ToolActive.Value == true do
        wait(0.1)
    end
    RShoulder.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
    Combo_Touch:disconnect()
    Combo_Touch = nil
    Anim.Disabled = false
end
event_BoneCrush.OnServerEvent:Connect(onBoneCrush)


0
HopperBins are deprecated. Also, there's a random mark in Selected `= false hiimgoodpack 2009 — 4y
0
I'll try using a Tool instead, also the apostrophe is from pasting it into here as code, my bad, I removed it now PleaseDadNotTheWhip 0 — 4y

Answer this question