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

Enemy not passing through fireserver?

Asked by 6 years ago
player.Character.LeftFoot.Touched:connect(function(hit)
                local enemy = hit.Parent
                local hum = enemy:FindFirstChild("Humanoid")
                if hum ~= nil then
                    if not touched then
                        print(enemy)
                        touched = true
                        game.ReplicatedStorage.Remotes.Moves.BoneCrush.Effects:FireServer(player, enemy)
                    end
                end
            end)

I can print(enemy) and it will show dummy in the output, but once I try to use enemy in the server script it will be a nil value.

game.ReplicatedStorage.Remotes.Moves.BoneCrush.Effects.OnServerEvent:connect(function(player, enemy)
    player.PlayerScripts.ControlScript.Disabled = true
    local pos = enemy:FindFirstChild("HumanoidRootPart").Position
    local it = game.ServerStorage.Instant_Transmission
    local cloned = it:Clone()
    cloned.Parent, player.Character.HumanoidRootPart.CFrame = workspace, CFrame.new(pos)
    cloned:MoveTo(player.Character.HumanoidRootPart.Position)
    game.ReplicatedStorage.Remotes.Moves.BoneCrush.Player:FireAllClients(player)
end)

^Server Script

Answer this question